:root {
  color-scheme: light;
  --navy: #10233f;
  --blue: #3568e8;
  --blue-dark: #2450bd;
  --ink: #1d2a3a;
  --muted: #68758a;
  --line: #dce3ee;
  --soft: #f4f7fb;
  --white: #fff;
  --green: #16845b;
  --amber: #a96805;
  --red: #b83b42;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at top right, #dfe9ff 0, transparent 34rem), var(--soft); }
button, input, textarea, select { font: inherit; }
button, .button-link { border: 0; border-radius: 10px; padding: .8rem 1rem; background: var(--blue); color: white; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; }
button:hover, .button-link:hover { background: var(--blue-dark); }
button.secondary, .button-link.secondary { color: var(--navy); background: #e8eefb; }
button.danger { background: #fff0f1; color: var(--red); }
button:disabled { opacity: .55; cursor: not-allowed; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: .75rem; background: white; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: .4rem; color: var(--navy); font-size: .9rem; font-weight: 650; }
h1, h2, h3, p { margin-top: 0; }
.app-shell { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
.topbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1.5rem; }
.brand { display: flex; gap: .8rem; align-items: center; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(145deg, var(--blue), #74a0ff); box-shadow: 0 10px 25px #3568e833; }
.brand p, .muted { color: var(--muted); }
.brand h1 { margin: 0; color: var(--navy); font-size: 1.25rem; }
.brand p { margin: .15rem 0 0; font-size: .84rem; }
.card, .loading-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem; box-shadow: 0 12px 35px #17345d10; }
.loading-card { margin-top: 20vh; text-align: center; }
.login-wrap { min-height: 75vh; display: grid; place-items: center; }
.login-card { width: min(430px, 100%); padding: 2rem; }
.stack { display: grid; gap: 1rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.workspace-nav { display: flex; gap: .5rem; margin-bottom: 1rem; }
.workspace-nav button { background: transparent; color: var(--muted); }
.workspace-nav button.active { background: var(--navy); color: white; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.library-shell { display: grid; gap: 1rem; }
.library-tabs { display: flex; gap: .5rem; padding: .35rem; width: fit-content; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.library-tabs button { background: transparent; color: var(--muted); }
.library-tabs button.active { background: var(--navy); color: #fff; }
.library-form-card { width: min(760px, 100%); }
.library-list-card { width: 100%; }
.library-review-text { margin: 1rem 0; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.library-photo-carousel { margin-top: 1rem; }
.library-photo-carousel .carousel-image { height: clamp(220px, 38vw, 380px); }
.form-actions { display: grid; grid-template-columns: 1fr auto; gap: .75rem; }
.field-help { color: var(--muted); font-size: .8rem; font-weight: 500; }
.item-list { display: grid; gap: .75rem; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: #fff; }
.item-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.badge { display: inline-flex; border-radius: 999px; padding: .25rem .6rem; background: #eef3ff; color: var(--blue-dark); font-size: .78rem; font-weight: 750; }
.badge.available { background: #e8f7f1; color: var(--green); }
.badge.reserved, .badge.issued { background: #fff3dc; color: var(--amber); }
.badge.used { background: #e7edff; color: var(--blue-dark); }
.notice { border-radius: 10px; padding: .8rem 1rem; background: #e8f7f1; color: #0d6846; }
.notice.error { background: #fff0f1; color: var(--red); }
.warning-card { border: 1px solid #efb4b8; border-radius: 12px; padding: 1rem; background: #fff0f1; color: #8e2930; }
.warning-card strong { display: block; margin-bottom: .4rem; color: var(--red); }
.warning-card ul { margin: 0; padding-left: 1.25rem; }
.warning-card p { margin: .55rem 0 0; }
.generated-link { display: grid; grid-template-columns: 1fr auto; gap: .6rem; }
.generated-link input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.operator-preview { margin-top: 1rem; }
.preview-task-name { display: grid; gap: .35rem; }
.preview-task-name strong { color: var(--navy); font-size: 1rem; }
.preview-review-link { display: block; width: 100%; }
.public-task { width: min(760px, 100%); margin: 0 auto; }
.task-timer { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 11px; background: #fff3dc; color: #704500; }
.timer-value { font-variant-numeric: tabular-nums; font-size: 1.15rem; font-weight: 800; }
.public-task-card { gap: 1.15rem; }
.task-instructions { border-radius: 14px; padding: 1rem 1.15rem; background: #f8faff; }
.task-instructions h2 { margin-bottom: .55rem; font-size: 1.05rem; color: var(--navy); }
.task-instructions ol { margin: 0; padding-left: 1.35rem; display: grid; gap: .4rem; line-height: 1.5; }
.photo-carousel { display: grid; gap: .45rem; }
.photo-stage { position: relative; overflow: visible; }
.carousel-image { display: none; width: 100%; height: clamp(240px, 52vw, 430px); object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.carousel-image.active { display: block; }
.carousel-arrow { position: absolute; z-index: 1; top: 50%; width: 42px; height: 52px; padding: 0; display: grid; place-items: center; border-radius: 12px; transform: translateY(-50%); background: var(--blue); color: #fff; font-size: 1.25rem; box-shadow: 0 6px 18px #17345d33; }
.carousel-arrow.previous { left: .65rem; }
.carousel-arrow.next { right: .65rem; }
.photo-counter { margin: 0; color: var(--muted); text-align: center; font-size: .82rem; }
.download-photos { width: 100%; min-height: 52px; font-size: 1rem; }
.download-photos span { margin-right: .35rem; font-size: 1.45rem; line-height: 0; }
.photo-save-hint { margin: -.5rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.photo-save-alternative { width: 100%; }
.individual-photo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.review-copy { padding: 1.25rem; border-radius: 12px; background: #f2f5fa; white-space: pre-wrap; user-select: none; -webkit-user-select: none; }
.task-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.expired { text-align: center; padding: 3rem 1.5rem; }
.hidden { display: none !important; }

@media (max-width: 720px) {
  .app-shell { width: calc(100% - 1rem); max-width: 1120px; padding: .75rem 0 calc(4rem + env(safe-area-inset-bottom, 0px)); }
  input, textarea, select { font-size: 16px; }
  .toolbar, .workspace-nav { flex-wrap: wrap; }
  .toolbar > *, .workspace-nav > * { min-height: 44px; }
  .item, .card, .library-shell, .library-list-card { min-width: 0; }
  .topbar, .item-head { align-items: stretch; flex-direction: column; }
  .grid, .task-actions { grid-template-columns: 1fr; }
  .individual-photo-list { grid-template-columns: 1fr; }
  .library-tabs { width: 100%; }
  .library-tabs button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: .75rem .35rem; }
  .form-actions { grid-template-columns: 1fr; }
  .generated-link { grid-template-columns: 1fr; }
  .public-task-card { padding: 1rem; }
  .task-instructions { padding: .9rem 1rem; }
  .carousel-image { height: clamp(230px, 76vw, 360px); }
  .carousel-arrow { width: 40px; height: 48px; }
  .carousel-arrow.previous { left: .4rem; }
  .carousel-arrow.next { right: .4rem; }
}
