/* ==========================================================
   Latch Games — playtest page (request, activate, sign in, dashboard)
   Builds on ../styles.css for colours, type, the header and buttons.
   ========================================================== */

.pt-body { background: var(--paper); }
[hidden] { display: none !important; }

/* Header: always the frosted bar here */
.pt-header { position: sticky; }
.pt-header nav { margin-right: clamp(18px, 2.4vw, 34px); }
.pt-header__account { display: flex; align-items: center; justify-self: end; gap: 14px; font-size: 13px; }
.pt-header__signin {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 20px;
  border: 1px solid rgba(28, 48, 56, .28); border-radius: 999px; transition: border-color .18s ease, color .18s ease;
}
.pt-header__signin:hover { border-color: var(--rust); color: var(--rust); }
.pt-header__user { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.pt-avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--rust); color: #fffaf1; font-family: Georgia, "Times New Roman", serif; font-size: 15px;
}
.pt-header__signout { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.pt-header__signout:hover { color: var(--rust); }

.pt-main { min-height: calc(100svh - 70px - 72px); }

/* ---------- Signed out: split screen ---------- */

.pt-gate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: calc(100svh - 70px);
}

.pt-story { position: relative; overflow: hidden; isolation: isolate; background: #96cceb; }
.pt-story__art { position: absolute; inset: 0; z-index: -1; }
.pt-story__art img {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: 58% 60%; transform: scale(1.12);
  animation: pt-drift 22s ease-in-out infinite alternate;
}
.pt-story__art img:nth-child(2) { animation-duration: 18s; }
.pt-story__art img:nth-child(3) { animation-duration: 14s; transform: scale(1.18); }
@keyframes pt-drift { to { transform: scale(1.18) translate3d(-1.2%, -1%, 0); } }
/* Paper wash at the top for the copy; dusk at the bottom for the steps */
.pt-story__art::before, .pt-story__art::after { content: ""; position: absolute; left: 0; right: 0; z-index: 1; }
.pt-story__art::before { top: 0; height: 55%; background: linear-gradient(rgba(237, 241, 238, .94), rgba(237, 241, 238, .55) 60%, rgba(237, 241, 238, 0)); }
.pt-story__art::after { bottom: 0; height: 46%; background: linear-gradient(rgba(16, 30, 35, 0), rgba(16, 30, 35, .78)); }

.pt-story__copy {
  display: flex; flex-direction: column; height: 100%;
  padding: clamp(48px, 6vw, 88px) var(--gutter) clamp(36px, 4vw, 56px);
}
.pt-eyebrow { margin-bottom: 16px; color: var(--rust-dark); font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.pt-story h1, .pt-dash h1 { margin-bottom: 18px; font-size: clamp(42px, 4.6vw, 72px); line-height: 1; text-wrap: balance; }
.pt-lede { max-width: 470px; margin-bottom: 0; color: var(--ink-soft); font-size: 16px; font-weight: 500; line-height: 1.65; }

.pt-steps {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  margin: auto 0 0; padding: 40px 0 0; list-style: none;
}
.pt-steps li {
  display: flex; gap: 14px; padding: 16px 18px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 14px;
  background: rgba(16, 30, 35, .42); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: #c9d6d8; font-size: 13px; line-height: 1.45;
}
.pt-steps span { color: #f2a27f; font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.1; }
.pt-steps strong { display: block; margin-bottom: 2px; color: #f7f5ee; font-size: 14px; font-weight: 600; }

/* ---------- Forms panel ---------- */

.pt-panel { padding: clamp(40px, 5vw, 76px) clamp(28px, 5vw, 88px) 56px; }

.pt-tabs {
  position: relative; display: flex; gap: 4px; width: max-content; max-width: 100%;
  margin-bottom: 40px; padding: 4px; border-radius: 999px; background: var(--mist);
}
.pt-tabs a {
  position: relative; z-index: 1; padding: 10px 18px; border-radius: 999px;
  color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; transition: color .25s ease;
}
.pt-tabs a[aria-selected="true"] { color: var(--ink); }
.pt-tabs__ink {
  position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 999px; background: #fbfcfa;
  box-shadow: 0 4px 14px -8px rgba(28, 48, 56, .45);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1), width .4s cubic-bezier(.2, .8, .2, 1);
}

.pt-view { max-width: 560px; animation: pt-in .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes pt-in { from { opacity: 0; transform: translateY(10px); } }

.pt-form h2, .pt-done h2, .pt-card h2 { margin-bottom: 8px; font-size: clamp(30px, 2.6vw, 40px); line-height: 1.05; }
.pt-form__intro { margin-bottom: 28px; color: var(--muted); font-size: 14px; line-height: 1.6; }

.pt-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.pt-field { display: block; min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
.pt-field > span, .pt-field legend { display: block; margin-bottom: 8px; padding: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.pt-field em { margin-left: 4px; color: var(--muted); font-style: normal; font-weight: 400; }
.pt-field input, .pt-field textarea, .pt-field select {
  display: block; width: 100%; min-height: 50px; padding: 0 18px;
  border: 1px solid rgba(28, 48, 56, .2); border-radius: 14px; background: #fbfcfa;
  color: var(--ink); font: inherit; font-size: 15px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.pt-field textarea { min-height: 0; padding: 14px 18px; line-height: 1.55; resize: vertical; }
.pt-field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%); background-position: right 22px center, right 17px center; background-size: 5px 5px; background-repeat: no-repeat; }
.pt-field input:focus, .pt-field textarea:focus, .pt-field select:focus {
  outline: none; border-color: var(--lake); box-shadow: 0 0 0 4px rgba(91, 127, 142, .16);
}
.pt-field [aria-invalid="true"] { border-color: var(--rust); }
.pt-code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 18px !important; letter-spacing: .14em; text-transform: uppercase; }
.pt-hint { margin: -10px 0 18px; color: var(--muted); font-size: 12px; }
.pt-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Chips and game picks are real checkboxes, styled */
.pt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-chips label, .pt-games label { position: relative; cursor: pointer; }
.pt-chips input, .pt-games input { position: absolute; opacity: 0; pointer-events: none; }
.pt-chips span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
  border: 1px solid rgba(28, 48, 56, .2); border-radius: 999px; background: #fbfcfa; font-size: 13px;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.pt-chips input:checked + span { border-color: var(--ink); background: var(--ink); color: #f4f2ec; }
.pt-games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pt-games span {
  display: grid; gap: 2px; padding: 12px 14px 12px 40px; border: 1px solid rgba(28, 48, 56, .2); border-radius: 14px;
  background: #fbfcfa; transition: border-color .18s ease, background-color .18s ease;
}
.pt-games span::before {
  content: ""; position: absolute; top: 15px; left: 14px; width: 16px; height: 16px; border: 1.5px solid rgba(28, 48, 56, .35); border-radius: 5px;
  background: #fff center / 12px no-repeat; transition: background-color .18s ease, border-color .18s ease;
}
.pt-games input:checked + span { border-color: var(--rust); background: #f7ebe4; }
.pt-games input:checked + span::before {
  border-color: var(--rust); background-color: var(--rust);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.2 4.2L19 7' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.pt-games strong { font-size: 14px; font-weight: 600; }
.pt-games small { color: var(--muted); font-size: 12px; }
.pt-games small.is-live { color: var(--lake); }
.pt-chips input:focus-visible + span, .pt-games input:focus-visible + span { outline: 2px solid var(--rust); outline-offset: 3px; }

.pt-msg { min-height: 0; margin: 0; font-size: 13px; }
.pt-msg:not(:empty) { margin: -4px 0 16px; padding: 12px 16px; border-radius: 12px; background: #e6eef0; color: var(--ink); }
.pt-msg.is-error:not(:empty) { background: #f6e3dc; color: var(--rust-dark); }
.pt-submit { min-height: 52px; padding: 0 30px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.pt-submit[disabled] { opacity: .6; cursor: progress; transform: none; }
.pt-switch { margin: 22px 0 0; color: var(--muted); font-size: 13px; }
.pt-switch a { color: var(--ink); font-weight: 500; border-bottom: 1px solid currentColor; }
.pt-switch a:hover { color: var(--rust); }

.pt-done { padding-top: 12px; }
.pt-done:focus { outline: none; }
.pt-done__icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 24px; border-radius: 50%; background: var(--lake); color: #fff; }
.pt-done__icon svg { width: 26px; height: 26px; }
.pt-done p { max-width: 440px; margin-bottom: 26px; color: var(--ink-soft); font-size: 15px; line-height: 1.7; }

/* ---------- Signed in: dashboard ---------- */

.pt-dash { padding: clamp(48px, 6vw, 88px) var(--gutter) clamp(64px, 7vw, 104px); animation: pt-in .5s cubic-bezier(.2, .8, .2, 1); }
.pt-dash__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: clamp(32px, 4vw, 52px); }
.pt-badge {
  display: inline-flex; flex: none; align-items: center; gap: 10px; margin: 0; padding: 10px 16px;
  border-radius: 999px; background: #dbe8ea; color: var(--lake); font-size: 13px; font-weight: 600;
}
.pt-pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pt-pulse::after { content: ""; position: absolute; inset: -5px; border: 1.5px solid currentColor; border-radius: 50%; animation: playtest-ping 2s ease-out infinite; }

.pt-builds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 0 0 clamp(28px, 3vw, 40px); padding: 0; list-style: none; }
.pt-build {
  --tint: #d7e5e8; --accent: var(--lake);
  position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: 20px; background: var(--tint);
}
.pt-build--rust { --tint: #ecdcd2; --accent: var(--rust); }
.pt-build--moss { --tint: #e1e5d3; --accent: var(--moss); }
.pt-build img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.pt-build__body { display: flex; flex: 1; flex-direction: column; padding: 20px 22px 22px; }
.pt-build__state { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--accent); font-size: 12px; font-weight: 600; }
.pt-build__state::before { content: ""; width: 7px; height: 7px; border: 1.5px solid currentColor; border-radius: 50%; }
.pt-build--open .pt-build__state::before { background: currentColor; }
.pt-build h3 { margin-bottom: 8px; font-size: 30px; line-height: 1; }
.pt-build p { margin-bottom: 18px; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.pt-build__cta { margin-top: auto; }
.pt-build__cta .button-link { min-height: 44px; }
.pt-build__wait { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.pt-build__wait svg { width: 18px; height: 18px; }

.pt-dash__grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pt-card { padding: clamp(24px, 3vw, 40px); border: 1px solid var(--rule); border-radius: 22px; background: #f6f8f5; }
.pt-card h2 { font-size: clamp(26px, 2.2vw, 34px); }

.pt-rating { margin-bottom: 20px; }
.pt-stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; min-height: 50px; align-items: center; }
.pt-stars input { position: absolute; opacity: 0; pointer-events: none; }
.pt-stars label { color: #c8d2d2; cursor: pointer; transition: color .15s ease, transform .15s ease; }
.pt-stars svg { display: block; width: 28px; height: 28px; }
.pt-stars label:hover, .pt-stars label:hover ~ label, .pt-stars input:checked ~ label { color: #e0a24a; }
.pt-stars label:hover { transform: scale(1.12); }
.pt-stars input:focus-visible + label { outline: 2px solid var(--rust); outline-offset: 2px; border-radius: 4px; }

.pt-history ul { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; }
.pt-history li { padding: 14px 16px; border-radius: 14px; background: #fff; font-size: 14px; line-height: 1.55; }
.pt-history li header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.pt-history li header strong { color: var(--ink); font-weight: 600; }
.pt-history li p { margin: 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.pt-empty { margin: 18px 0 0; color: var(--muted); font-size: 14px; }
.pt-account { display: grid; gap: 10px; margin: 26px 0 0; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 13px; }
.pt-account div { display: flex; justify-content: space-between; gap: 12px; }
.pt-account dt { color: var(--muted); }
.pt-account dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; text-align: right; }

.pt-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 72px; padding: 0 var(--gutter); background: #101e23; color: #7f979c; font-size: 12px;
}
.pt-footer p { margin: 0; }
.pt-footer a { color: #dfe7e6; }
.pt-footer a:hover { color: #f2a27f; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .pt-gate { grid-template-columns: 1fr; }
  .pt-story__copy { min-height: 0; }
  .pt-steps { margin-top: 40px; }
  .pt-panel { padding-top: 40px; }
  .pt-view { max-width: none; }
  .pt-dash__grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .pt-header nav { display: none; }
  .pt-header { grid-template-columns: 1fr auto; }
  .pt-header__user [data-user-name] { display: none; }
  .pt-header__signin { min-height: 36px; padding: 0 16px; font-size: 12px; }
  .pt-story__copy { padding: 40px 24px 28px; }
  .pt-story h1, .pt-dash h1 { font-size: clamp(36px, 10.4vw, 44px); }
  .pt-lede { font-size: 15px; }
  .pt-steps { grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 28px; }
  .pt-steps li { flex-direction: column; gap: 6px; padding: 12px 14px; font-size: 12px; }
  .pt-steps strong { font-size: 13px; }
  .pt-panel { padding: 28px 20px 44px; }
  .pt-tabs { width: 100%; margin-bottom: 28px; }
  .pt-tabs a { flex: 1; padding: 10px 6px; font-size: 12px; text-align: center; }
  .pt-row { grid-template-columns: 1fr; }
  .pt-games { grid-template-columns: 1fr; }
  .pt-submit { width: 100%; justify-content: center; }
  .pt-dash__head { flex-direction: column; align-items: flex-start; }
  .pt-dash { padding: 36px 20px 56px; }
  .pt-footer { flex-direction: column; justify-content: center; gap: 8px; padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .pt-story__art img, .pt-view, .pt-dash, .pt-pulse::after { animation: none; }
  .pt-tabs__ink { transition: none; }
}
