:root {
  color-scheme: dark;
  --app-height: 100dvh;
  --bg: #050608;
  --panel: rgba(19, 22, 26, 0.92);
  --panel-soft: rgba(24, 28, 34, 0.86);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5f7fb;
  --muted: #b5bfcc;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  --teal: #15d1b0;
  --teal-deep: #0c7669;
  --purple: #8d61ff;
  --purple-deep: #41236f;
  --gold: #f7b70a;
  --gold-deep: #6a4610;
  --orange: #f2ab17;
  --orange-deep: #65430f;
  --danger: #ff5a73;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at top, rgba(42, 52, 69, 0.4), transparent 38%),
    radial-gradient(circle at bottom left, rgba(20, 135, 115, 0.18), transparent 25%),
    #050608;
  color: var(--text);
  font-family:
    "Avenir Next",
    "Segoe UI",
    sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

body {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
}

.app-shell {
  position: fixed;
  inset: 0;
  width: min(100%, 480px);
  height: var(--app-height);
  max-height: var(--app-height);
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + 14px)
    calc(var(--safe-right) + 16px)
    calc(var(--safe-bottom) + 24px)
    calc(var(--safe-left) + 16px);
  overflow: hidden;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  font-size: 2rem;
}

.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(14, 17, 21, 0.98);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 20;
}

.menu button {
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  flex: none;
}

.context-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 100px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.context-card select {
  position: absolute;
  inset: 0;
  opacity: 0.01;
  width: 100%;
  height: 100%;
  appearance: none;
}

.playmaker-card {
  background: linear-gradient(135deg, rgba(242, 171, 23, 0.35), rgba(101, 67, 15, 0.8));
}

.checkpoint-card {
  background: linear-gradient(135deg, rgba(141, 97, 255, 0.3), rgba(65, 35, 111, 0.9));
}

.context-card__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 205, 73, 0.95);
  color: #161616;
  font-size: 1.7rem;
  flex: none;
}

.checkpoint-card .context-card__icon {
  background: transparent;
  color: #fff;
  font-size: 2rem;
}

.context-card__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.context-card__label {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.95rem;
}

.context-card__value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.context-card__chevron {
  margin-left: auto;
  font-size: 1.8rem;
}

.capture-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.camera-panel,
.note-panel {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(11, 14, 17, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.camera-preview,
.media-preview,
.camera-empty {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  display: block;
}

.camera-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.54)),
    radial-gradient(circle at center, rgba(18, 131, 111, 0.14), transparent 44%);
}

.camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.media-preview {
  background: #050608;
}

.capture-button,
.recording-pill {
  pointer-events: auto;
}

.capture-button {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.capture-button--photo {
  width: 110px;
  height: 110px;
  padding: 10px;
  background: #fff;
}

.capture-button__inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), #0ba68e);
}

.capture-button--video {
  min-width: 148px;
  height: 64px;
  padding: 0 24px;
  background: linear-gradient(135deg, rgba(141, 97, 255, 0.98), rgba(65, 35, 111, 0.98));
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}

.capture-button--video.is-recording {
  background: linear-gradient(135deg, rgba(255, 90, 115, 0.98), rgba(123, 18, 35, 0.98));
}

.recording-pill {
  position: absolute;
  top: 18px;
  left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(9, 10, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 600;
}

.recording-pill__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4a5f;
}

.status-banner {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 150px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(22, 26, 33, 0.9);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.note-panel {
  padding: 18px;
}

.note-panel textarea {
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 18px;
  border: 0;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  resize: none;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.delete-capture-button {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 90, 115, 0.42);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 90, 115, 0.98), rgba(148, 20, 44, 0.98));
  color: #fff;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  font-size: 1.4rem;
  font-weight: 700;
}

.reel-section {
  overflow: hidden;
  margin-bottom: 8px;
  flex: none;
}

.reel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.reel::-webkit-scrollbar {
  display: none;
}

.reel-card {
  position: relative;
  flex: 0 0 102px;
  min-height: 102px;
  max-height: 102px;
  max-width: 102px;
  padding: 0;
  border-radius: 20px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  overflow: hidden;
}

.reel-card.is-selected {
  border-color: #1ad6b5;
}

.reel-card--add {
  display: grid;
  place-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.22);
}

.reel-card__plus {
  font-size: 2rem;
  line-height: 1;
}

.reel-card img,
.reel-card video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-card__type-badge,
.reel-card__edit-badge {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-size: 0.72rem;
  font-weight: 700;
}

.reel-card__type-badge {
  top: 6px;
  right: 6px;
}

.reel-card__edit-badge {
  bottom: 6px;
  right: 6px;
}

.reel-card__note {
  height: 100%;
  max-height: 100%;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f3b80e, #e49000);
  color: #111;
  text-align: left;
  font-size: 0.75rem;
  line-height: 1.2;
  overflow: hidden;
}

.reel-card__video {
  display: flex;
  height: 100%;
  align-items: end;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(141, 97, 255, 0.9), rgba(65, 35, 111, 1));
  font-weight: 700;
  font-size: 0.75rem;
}

.reel-card__meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.33));
  text-align: left;
}

.reel-card__meta strong,
.reel-card__meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reel-card__meta span {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.68rem;
}

.mode-switch {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  flex: none;
}

.mode-card {
  min-height: 120px;
  padding: 18px 12px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
  box-shadow: var(--shadow);
}

.mode-card__icon {
  font-size: 2.6rem;
}

.mode-card span:last-child {
  font-size: 1.05rem;
  font-weight: 700;
}

.mode-card--photo {
  background: linear-gradient(135deg, var(--teal-deep), var(--teal));
}

.mode-card--video {
  background: linear-gradient(135deg, var(--purple-deep), var(--purple));
}

.mode-card--note {
  background: linear-gradient(135deg, var(--gold), #d68f00);
  color: #111;
}

.mode-card.is-active {
  border-color: rgba(255, 255, 255, 0.72);
  transform: translateY(-2px);
}

@media (max-width: 380px) {
  .selectors {
    grid-template-columns: 1fr;
  }
}
