:root {
  color-scheme: dark;
  --bg: #0b0713;
  --bg-elevated: #130d24;
  --panel: #181126;
  --panel-strong: #211735;
  --border: #3d2c58;
  --border-bright: #654691;
  --text: #fffdf7;
  --muted: #bcb2c9;
  --purple: #a855f7;
  --purple-bright: #c084fc;
  --violet: #6d28d9;
  --neon: #2dd4bf;
  --danger: #fb7185;
  --warning: #fbbf24;
  --cinematic: #ffe5cc;
  --vlog: #d4f1f4;
  --atmosphere: #f0e6ff;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 18px;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding-bottom: calc(84px + var(--safe-bottom));
  background:
    radial-gradient(circle at 85% -5%, rgb(109 40 217 / 32%), transparent 30rem),
    linear-gradient(180deg, #130d24 0, var(--bg) 28rem);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
}

button,
summary,
label {
  touch-action: manipulation;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--neon);
  color: #08120f;
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: none;
}

.app-header {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 16px 14px;
}

.header-row,
.progress-heading,
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--purple-bright);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.13em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 9vw, 2.7rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

h2 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

h3 {
  margin: 0;
  font-size: 1.08rem;
}

.network-status {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgb(45 212 191 / 42%);
  border-radius: 999px;
  background: rgb(45 212 191 / 12%);
  color: #9ff6e9;
  font-size: 0.76rem;
  font-weight: 800;
}

.network-status::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon);
  content: "";
}

.network-status.is-offline {
  border-color: rgb(251 191 36 / 45%);
  background: rgb(251 191 36 / 12%);
  color: #fde68a;
}

.network-status.is-offline::before {
  background: var(--warning);
}

.global-progress {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgb(24 17 38 / 86%);
}

.progress-heading > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-heading strong {
  color: var(--text);
  font-size: 0.95rem;
}

#global-progress-percent {
  color: var(--neon);
  font-size: 1.1rem;
}

.progress-track,
.mini-track {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #08050d;
}

.progress-track span,
.mini-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--purple-bright), var(--neon));
}

.install-hint {
  display: flex;
  max-width: 728px;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto 12px;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  background: #281a42;
}

.install-hint p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  font-size: 1.5rem;
}

.sticky-controls {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 8px max(16px, calc((100vw - 760px) / 2 + 16px)) 10px;
  border-block: 1px solid rgb(61 44 88 / 70%);
  background: rgb(11 7 19 / 92%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.day-nav {
  display: flex;
  max-width: 728px;
  gap: 7px;
  margin: 0 auto;
  padding: 0 0 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.day-nav::-webkit-scrollbar {
  display: none;
}

.day-tab {
  flex: 0 0 auto;
  min-width: 48px;
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.day-tab.is-active {
  border-color: var(--purple-bright);
  background: var(--violet);
  color: white;
}

.day-tab small {
  display: block;
  margin-top: 2px;
  color: inherit;
  font-size: 0.65rem;
  opacity: 0.82;
}

.search-row {
  display: flex;
  max-width: 728px;
  gap: 8px;
  margin: 0 auto;
}

.search-box {
  display: flex;
  min-width: 0;
  min-height: 48px;
  flex: 1;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--panel);
}

.search-box > span[aria-hidden] {
  color: var(--purple-bright);
  font-size: 1.4rem;
}

.search-box input {
  min-width: 0;
  height: 46px;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.search-box input::placeholder {
  color: #8e829e;
}

.filter-button {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border-bright);
  border-radius: 13px;
  background: #281a42;
  font-weight: 850;
}

.count-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-left: 4px;
  place-items: center;
  border-radius: 999px;
  background: var(--neon);
  color: #071713;
  font-size: 0.72rem;
}

.active-filter-chips {
  display: flex;
  max-width: 728px;
  gap: 6px;
  margin: 8px auto 0;
  overflow-x: auto;
}

.active-filter-chips:empty {
  display: none;
}

.active-chip {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: #2a1e3e;
  color: #d8cce6;
  font-size: 0.72rem;
}

main {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 14px 16px 40px;
}

.dashboard {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 100% 0, rgb(168 85 247 / 31%), transparent 55%),
    linear-gradient(135deg, #211237, #181126 62%);
}

.dashboard::after {
  position: absolute;
  right: -55px;
  bottom: -65px;
  width: 160px;
  height: 160px;
  border: 22px solid rgb(45 212 191 / 8%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.dashboard-copy p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}

.stat-card {
  padding: 12px;
  border: 1px solid rgb(101 70 145 / 70%);
  border-radius: 13px;
  background: rgb(8 5 13 / 43%);
}

.stat-card > span {
  display: block;
  min-height: 28px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.stat-card strong {
  display: block;
  margin-top: 2px;
  font-size: 1.18rem;
}

.high-stat .mini-track span {
  background: linear-gradient(90deg, #f97316, var(--warning));
}

.reminder-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.reminder-panel summary {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  cursor: pointer;
  list-style: none;
}

.reminder-panel summary::-webkit-details-marker {
  display: none;
}

.reminder-panel summary span:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reminder-panel summary small {
  color: var(--muted);
}

.reminder-panel summary span:last-child {
  color: var(--purple-bright);
  font-size: 1.6rem;
  transform: rotate(90deg);
}

.reminder-panel[open] summary span:last-child {
  transform: rotate(-90deg);
}

.reminder-list {
  display: grid;
  gap: 1px;
  padding: 0 10px 10px;
}

.reminder-item {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-top: 1px solid rgb(61 44 88 / 50%);
}

.reminder-item input,
.filter-option input {
  width: 24px;
  height: 24px;
  accent-color: var(--neon);
}

.result-summary {
  min-height: 42px;
  padding: 18px 2px 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.act-section + .act-section {
  margin-top: 24px;
}

.act-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 9px;
}

.act-heading h2 {
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.act-heading span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
}

.shot-stack {
  display: grid;
  gap: 10px;
}

.shot-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(150deg, #1c142b, var(--panel));
  box-shadow: 0 8px 26px rgb(0 0 0 / 18%);
}

.shot-card.is-recorded {
  border-color: #2d3540;
  background: #111017;
  opacity: 0.72;
}

.shot-card.is-retry {
  border-color: rgb(251 113 133 / 70%);
  box-shadow: inset 4px 0 0 var(--danger);
}

.shot-card-body {
  padding: 14px;
}

.shot-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.shot-number {
  color: var(--purple-bright);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.priority {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.priority-high {
  border-color: rgb(251 113 133 / 45%);
  background: rgb(251 113 133 / 12%);
  color: #fecdd3;
}

.shot-title {
  margin: 8px 0 10px;
  font-size: 1.04rem;
  line-height: 1.35;
}

.is-recorded .shot-title {
  color: #918a99;
  text-decoration: line-through;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.69rem;
  font-weight: 850;
}

.type-cinematic {
  background: var(--cinematic);
  color: #48230b;
}

.type-vlog {
  background: var(--vlog);
  color: #0c4146;
}

.type-atmosphere {
  background: var(--atmosphere);
  color: #39215a;
}

.camera-badge {
  border: 1px solid #514161;
  background: #2a2034;
  color: #e8dfef;
}

.owner-badge {
  border: 1px solid rgb(251 191 36 / 35%);
  background: rgb(251 191 36 / 9%);
  color: #fde68a;
}

.shot-details,
.note-details {
  margin-top: 11px;
  border-top: 1px solid rgb(61 44 88 / 55%);
}

.shot-details summary,
.note-details summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  list-style: none;
}

.shot-details summary::-webkit-details-marker,
.note-details summary::-webkit-details-marker {
  display: none;
}

.shot-details summary::after,
.note-details summary::after {
  margin-left: auto;
  color: var(--purple-bright);
  content: "+";
}

.shot-details[open] summary::after,
.note-details[open] summary::after {
  content: "−";
}

.shot-details p {
  margin: 0 0 12px;
  color: #ddd4e5;
  font-size: 0.88rem;
  line-height: 1.45;
}

.note-details textarea {
  width: 100%;
  min-height: 92px;
  margin-bottom: 12px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: 0;
  background: #0d0914;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.4;
}

.note-details textarea:focus {
  border-color: var(--neon);
}

.status-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-top: 1px solid var(--border);
  background: #281a42;
  color: #eee6f7;
  font-weight: 900;
}

.status-button::before {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid var(--purple-bright);
  border-radius: 50%;
  content: "○";
}

.is-recorded .status-button {
  border-color: #264941;
  background: #12312c;
  color: #a7f3d0;
}

.is-recorded .status-button::before {
  border-color: var(--neon);
  background: var(--neon);
  color: #071713;
  content: "✓";
}

.is-retry .status-button {
  border-color: rgb(251 113 133 / 55%);
  background: #421827;
  color: #fecdd3;
}

.is-retry .status-button::before {
  border-color: var(--danger);
  color: var(--danger);
  content: "↻";
}

.empty-state {
  padding: 38px 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state p {
  color: var(--muted);
}

.content-view {
  display: grid;
  gap: 14px;
}

.view-heading {
  padding: 12px 2px 4px;
}

.view-heading p:last-child {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.info-section,
.backup-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.info-section h3,
.backup-card h3 {
  margin-bottom: 12px;
}

.must-shot-list,
.crew-task-list {
  display: grid;
  gap: 8px;
}

.must-shot {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #120c1c;
  text-align: left;
}

.must-shot::before {
  display: grid;
  width: 26px;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border: 2px solid var(--purple-bright);
  border-radius: 50%;
  color: transparent;
  content: "✓";
}

.must-shot.is-done {
  color: var(--muted);
  text-decoration: line-through;
}

.must-shot.is-done::before {
  border-color: var(--neon);
  background: var(--neon);
  color: #071713;
}

.crew-task {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #120c1c;
}

.crew-task summary {
  min-height: 54px;
  padding: 13px;
  cursor: pointer;
  font-weight: 850;
}

.crew-task-body {
  padding: 0 13px 13px;
}

.crew-task-body p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.crew-task-body strong {
  color: var(--purple-bright);
}

.tech-tip-list,
.offline-steps {
  margin: 0;
  padding-left: 1.3rem;
}

.tech-tip-list li,
.offline-steps li {
  padding: 6px 0;
  color: #e5ddec;
  line-height: 1.4;
}

.backup-actions {
  display: grid;
  gap: 9px;
}

.primary-button,
.secondary-button,
.file-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border-radius: 12px;
  font-weight: 850;
  text-align: center;
}

.primary-button {
  border: 1px solid var(--purple-bright);
  background: var(--violet);
  color: white;
}

.secondary-button,
.file-button {
  border: 1px solid var(--border-bright);
  background: #281a42;
  color: var(--text);
}

.backup-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.backup-meta strong {
  color: var(--text);
}

.import-card p {
  color: var(--muted);
  line-height: 1.4;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: calc(68px + var(--safe-bottom));
  padding: 5px max(10px, calc((100vw - 760px) / 2 + 10px)) var(--safe-bottom);
  border-top: 1px solid var(--border);
  background: rgb(13 9 20 / 96%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bottom-nav-button {
  min-height: 58px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.bottom-nav-button span {
  display: grid;
  width: 25px;
  height: 25px;
  margin: 0 auto 3px;
  place-items: center;
  border: 1px solid currentcolor;
  border-radius: 8px;
  font-size: 0.88rem;
}

.bottom-nav-button.is-active {
  background: #25183a;
  color: #e9d5ff;
}

.filter-dialog {
  width: min(100%, 620px);
  max-height: min(88vh, 850px);
  margin: auto auto 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-bright);
  border-radius: 22px 22px 0 0;
  background: var(--bg-elevated);
  color: var(--text);
}

.filter-dialog::backdrop {
  background: rgb(0 0 0 / 72%);
  backdrop-filter: blur(3px);
}

.filter-dialog form {
  display: flex;
  max-height: inherit;
  flex-direction: column;
}

.dialog-heading {
  flex: 0 0 auto;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.filter-groups {
  display: grid;
  gap: 22px;
  padding: 17px 16px 22px;
  overflow-y: auto;
}

.filter-group {
  border: 0;
  margin: 0;
  padding: 0;
}

.filter-group legend {
  margin-bottom: 9px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.filter-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.filter-option {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
  font-size: 0.83rem;
  font-weight: 750;
}

.filter-option:has(input:checked) {
  border-color: var(--purple-bright);
  background: #2b1947;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 8px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(84px + var(--safe-bottom));
  left: 16px;
  z-index: 60;
  max-width: 520px;
  min-height: 48px;
  margin: 0 auto;
  padding: 13px 16px;
  border: 1px solid var(--border-bright);
  border-radius: 13px;
  background: #2b1947;
  box-shadow: 0 12px 40px rgb(0 0 0 / 45%);
  text-align: center;
  font-weight: 800;
}

@media (min-width: 620px) {
  .dashboard {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    align-items: end;
    gap: 24px;
  }

  .stat-grid {
    margin-top: 0;
  }

  .backup-actions {
    grid-template-columns: 1fr 1fr;
  }

  .filter-dialog {
    margin: auto;
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
