:root {
  --bg: #0b0910;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #fdf7fb;
  --muted: rgba(253, 247, 251, 0.66);
  --dim: rgba(253, 247, 251, 0.42);
  --hot: #ff4d8d;
  --violet: #a05cff;
  --rose: #ff8ec0;
  --ok: #74f4c8;
  --danger: #ff6b8b;
  --grad: linear-gradient(135deg, #ff4d8d, #a05cff);
  --shadow: 0 20px 56px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(120% 80% at 12% -8%, rgba(255, 77, 141, 0.22), transparent 46%),
    radial-gradient(110% 70% at 100% 4%, rgba(160, 92, 255, 0.24), transparent 50%),
    linear-gradient(180deg, #15101f 0%, #0b0910 44%, #07060c 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

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

.app-shell {
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 20px 20px 40px;
}

.feed-mode .app-shell {
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 0;
}

.feed-mode .hero {
  display: none;
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 4px 0 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand,
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(14px);
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.live-pill {
  gap: 6px;
  padding: 6px 13px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.live-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger);
}

.eyebrow,
.step {
  margin: 0 0 12px;
  color: var(--rose);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(34px, 9.5vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.hero-copy p:last-child {
  max-width: 36ch;
  margin-top: 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 500;
}

/* ---------- Panels ---------- */
.panel,
.ended-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

.panel {
  padding: 20px;
  margin-top: 16px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head .step {
  margin: 0;
}

h2 {
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 800;
}

/* ---------- Region ---------- */
.region-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.region-chip {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.region-chip:hover {
  border-color: var(--line-strong);
}

.region-chip:active,
.primary-button:active,
.secondary-button:active,
.heart-button:active,
.modal-close:active,
.feed-expire-button:active {
  transform: scale(0.96);
}

.region-chip.active {
  border-color: transparent;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 77, 141, 0.32);
}

/* ---------- Camera ---------- */
.camera-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #08070d;
}

.camera-video,
.camera-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera-video {
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-placeholder {
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 77, 141, 0.1), rgba(160, 92, 255, 0.14));
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.38);
  color: #fff;
  font-size: 96px;
  font-weight: 800;
  text-shadow: 0 8px 32px rgba(255, 77, 141, 0.6);
}

.record-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.record-badge span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 14px var(--danger);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

.record-progress {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.record-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  transition: width 120ms linear;
}

.status-copy,
.small-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 500;
}

.small-note {
  color: var(--danger);
}

/* ---------- Buttons ---------- */
.recorder-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 12px 30px rgba(255, 77, 141, 0.28);
}

.primary-button:hover {
  filter: brightness(1.06);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.primary-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7) opacity(0.55);
  box-shadow: none;
}

/* ---------- Session feed (setlog split-grid) ---------- */
@keyframes pop {
  40% { transform: scale(1.28); }
}

.session-panel {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.feed-topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: rgba(11, 9, 16, 0.74);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

.feed-topbar .step {
  margin: 0 0 2px;
}

.feed-topbar h2 {
  font-size: 16px;
  letter-spacing: 0.04em;
}

.timer-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 13px;
  border: 1px solid rgba(255, 142, 192, 0.3);
  border-radius: 999px;
  background: rgba(255, 77, 141, 0.1);
  white-space: nowrap;
}

.timer-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.timer-card strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-card.urgent {
  border-color: rgba(255, 107, 139, 0.6);
  background: rgba(255, 107, 139, 0.16);
  animation: pulse 0.9s ease-in-out infinite;
}

.timer-card.urgent span {
  color: var(--danger);
}

.timer-card.urgent strong {
  background: var(--danger);
}

.session-feed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 10px 86px;
}

.feed-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #0e0a16;
}

.feed-card.my-card {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 10;
  border-color: rgba(255, 142, 192, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 142, 192, 0.25), 0 14px 36px rgba(255, 77, 141, 0.18);
}

.feed-card.matched {
  border-color: rgba(255, 142, 192, 0.7);
}

.feed-media {
  position: absolute;
  inset: 0;
}

.feed-media img,
.feed-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.my-card .feed-media video {
  transform: scaleX(-1);
}

.feed-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(7, 4, 12, 0.86) 100%);
}

.tile-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-soft);
}

.live-dot {
  position: absolute;
  top: 11px;
  left: 11px;
  z-index: 2;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px var(--ok);
  animation: pulse 1.4s ease-in-out infinite;
}

.feed-meta {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 11px;
  z-index: 2;
}

.feed-meta strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.my-card .feed-meta strong {
  font-size: 19px;
}

.feed-meta strong .age {
  margin-left: 6px;
  font-size: 0.78em;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  text-shadow: inherit;
}

.feed-meta span {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
}

.tile-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: grid;
  gap: 7px;
  justify-items: end;
}

.heart-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(12, 8, 18, 0.42);
  color: #fff;
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
  backdrop-filter: blur(12px);
  transition: transform 160ms ease, background 160ms ease;
}

.heart-button.active {
  border-color: transparent;
  background: var(--grad);
  animation: pop 320ms ease;
}

.heart-button[disabled] {
  cursor: default;
}

.insta-mini {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.feed-expire-button {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 9;
  transform: translateX(-50%);
  min-height: 36px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 6, 13, 0.82);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(14px);
}

.feed-expire-button:active {
  transform: translateX(-50%) scale(0.96);
}

/* ---------- Ended ---------- */
.ended-panel {
  margin-top: 18px;
}

.ended-card {
  padding: 36px 24px;
  text-align: center;
}

.ended-card h2 {
  font-size: 28px;
}

.ended-card p:not(.eyebrow) {
  margin: 12px auto 22px;
  max-width: 30ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.ended-card .secondary-button {
  margin-top: 10px;
}

.cta-hook {
  margin: 0 auto 14px !important;
  max-width: 30ch;
  color: var(--text) !important;
  font-size: 13.5px !important;
  line-height: 1.6 !important;
}

.cta-hook b {
  font-weight: 800;
}

.kw {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
}

.insta-box em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  font-style: normal;
}

.insta-box em .kw {
  padding: 0 6px;
  font-size: 11.5px;
}

.insta-cta {
  gap: 8px;
  font-size: 14px;
}

.insta-cta::before {
  content: "";
  width: 17px;
  height: 17px;
  border-radius: 5px;
  background:
    radial-gradient(circle at 30% 110%, #fdd854 8%, #ff543e 34%, #c837ab 62%, transparent 70%),
    linear-gradient(135deg, #6559ca, #bc318f);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}

/* ---------- Match modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 5, 11, 0.74);
  backdrop-filter: blur(14px);
  animation: fade 200ms ease;
}

@keyframes fade {
  from { opacity: 0; }
}

.match-card {
  position: relative;
  width: min(100%, 380px);
  padding: 32px 24px 24px;
  border: 1px solid rgba(255, 142, 192, 0.28);
  border-radius: 26px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 77, 141, 0.18), transparent 60%),
    rgba(18, 13, 26, 0.97);
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes rise {
  from { transform: translateY(16px) scale(0.97); opacity: 0; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.match-avatars {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.match-avatar {
  width: 104px;
  height: 104px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  object-fit: cover;
}

.match-avatar.my-avatar video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.match-heart {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin: 0 -24px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 12px 32px rgba(255, 77, 141, 0.45);
  z-index: 2;
  animation: pop 480ms ease 120ms both;
}

.match-card h2 {
  font-size: 32px;
}

.match-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
  font-weight: 500;
}

.insta-box {
  display: grid;
  gap: 5px;
  margin: 20px 0 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.insta-box span {
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.insta-box strong {
  font-size: 24px;
  font-weight: 800;
}

.insta-button {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 360px) {
  .app-shell {
    padding: 16px 14px 32px;
  }
  .region-chip {
    font-size: 14px;
  }
}
