:root {
  --bg: #1d0f3d;
  --panel: #2a1658;
  --panel-edge: #4a2a96;
  --text: #f6efff;
  --muted: #c3aeea;
  --purple: #8f3df2;
  --pink: #ff8be8;
  --danger: #ff6b7d;
  --ok: #7be3a4;
  --warn: #ffd36b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(140% 100% at 20% 0%, #3a1a7a 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Nunito", "Segoe UI", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(100deg, #b84cf5, #6f2bdb);
}
.top__logo { height: 40px; }
.top h1 { margin: 0; font-size: 20px; font-weight: 800; }
.top__link { margin-left: auto; color: #fff; font-weight: 700; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px max(32px, env(safe-area-inset-bottom)); display: grid; gap: 14px; }
#app { display: grid; gap: 14px; }

.panel { padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--panel-edge); }
.panel h2 { margin: 0 0 12px; font-size: 17px; font-weight: 800; color: var(--pink); }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; }
.muted { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.banner { margin: 0; padding: 12px 14px; border-radius: 12px; background: #4d1d2a; border: 1px solid var(--danger); color: #ffd9de; font-weight: 700; }

.status__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill { padding: 4px 14px; border-radius: 999px; font-weight: 800; background: #44307a; }
.pill[data-phase="open"] { background: var(--ok); color: #0d3a20; }
.pill[data-phase="paused"] { background: var(--warn); color: #4a3500; }
.pill[data-phase="locked"] { background: var(--purple); }
.pill[data-phase="revealed"] { background: var(--pink); color: #4a1240; }
.status__clock { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.status__question { margin: 12px 0; font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.status__facts { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: end; }
.label { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.fact { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }

.secret {
  display: block;
  width: 100%;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px dashed var(--panel-edge);
  background: #1d0f3d;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.secret.is-shown { color: var(--text); border-style: solid; font-size: 20px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid--three { grid-template-columns: repeat(3, 1fr); }

.btn {
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--panel-edge);
  background: #3a2273;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:focus-visible, .secret:focus-visible, .link:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn--primary { background: linear-gradient(100deg, #a746f5, #7b2ff0); border-color: #c58bff; }
.btn--danger { background: #4d1d2a; border-color: var(--danger); color: #ffd9de; grid-column: 1 / -1; }
.btn--wide { width: 100%; margin-top: 12px; }

.link { border: 0; background: none; color: var(--pink); font: inherit; font-weight: 800; cursor: pointer; text-decoration: underline; }

.field { display: grid; gap: 4px; margin-top: 10px; }
.field--inline { grid-template-columns: auto 110px; align-items: center; justify-content: start; gap: 12px; margin-top: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { font-size: 14px; font-weight: 700; color: var(--muted); }
input[type="text"], input[type="number"], input[type="password"], textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
  background: #1d0f3d;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* below 16px iOS zooms into the field */
}
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 15px; color: var(--text); }
.check input { width: 22px; height: 22px; accent-color: var(--purple); }

.own { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--panel-edge); }
.own summary { font-weight: 800; cursor: pointer; padding: 6px 0; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; background: #1d0f3d; font-weight: 700; }
.list li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li span:last-child { font-variant-numeric: tabular-nums; color: var(--pink); white-space: nowrap; }
.list.is-secret li span:last-child { filter: blur(7px); user-select: none; }

.commands { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.commands dt { font-weight: 800; color: var(--pink); white-space: nowrap; }
.commands dd { margin: 0; color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  translate: -50% 0;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #4d1d2a;
  border: 1px solid var(--danger);
  color: #ffd9de;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

@media (max-width: 420px) {
  .field-row { grid-template-columns: 1fr; }
  .commands { grid-template-columns: 1fr; }
  .commands dd { margin-bottom: 6px; }
}
