:root{
  --bg0:#0b0f1a;
  --bg1:#121b2f;
  --card:rgba(255,255,255,.06);
  --card2:rgba(255,255,255,.10);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.70);
  --hot:#ff3b7a;
  --hot2:#ffb3c8;
  --shadow:rgba(0,0,0,.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  font-family: ui-rounded, system-ui, -apple-system, "SF Pro Rounded", "SF Pro Display", "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 15% 10%, rgba(255,59,122,.22), transparent 60%),
    radial-gradient(900px 600px at 85% 20%, rgba(255,179,200,.16), transparent 55%),
    radial-gradient(1000px 800px at 60% 90%, rgba(95,143,255,.18), transparent 60%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
}

.wrap{
  max-width: 1480px;
  margin: 0 auto;
  padding: 14px 12px 18px;
}

.top{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card), transparent);
  box-shadow: 0 20px 60px var(--shadow);
  border: 1px solid rgba(255,255,255,.08);
}

.kicker{
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

h1{
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.1;
}

.actions{display:flex; gap:10px}
.btn{
  appearance:none;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 650;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.btn:hover{background: rgba(255,255,255,.10)}
.btn:active{transform: translateY(1px)}
.btn.primary{
  border-color: rgba(255,59,122,.42);
  background: linear-gradient(180deg, rgba(255,59,122,.30), rgba(255,59,122,.10));
}

.stage{
  margin-top: 12px;
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.10);
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

canvas{
  width: 100%;
  height: auto;
  display:block;
  background: rgba(0,0,0,.10);
  max-width: 100%;
  max-height: 100%;
}

.modal{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 28px 18px;
  background: rgba(0,0,0,.30);
  backdrop-filter: blur(6px);
  overflow: auto;
}
.modal.hidden{display:none}
.modal-card{
  width: min(980px, 100%);
  border-radius: 18px;
  padding: 22px 18px 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.40);
  box-shadow: 0 30px 90px rgba(0,0,0,.40);
  margin: 0 auto;
  max-height: calc(100vh - 110px);
  overflow: auto;
}
.modal-title{
  font-weight: 850;
  font-size: 22px;
  text-align:center;
  margin-bottom: 14px;
  color: rgba(255,255,255,.94);
}
.modal-lines{
  text-align:center;
  color: rgba(255,255,255,.80);
  font-weight: 650;
  font-size: 16px;
  line-height: 1.5;
  padding: 0 6px;
  word-break: break-word;
  max-width: 820px;
  margin: 0 auto;
}
.modal-lines > div{margin: 4px 0}
.modal-media{
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.modal-media audio,
.modal-media .media-loading{
  grid-column: 1 / -1;
}
.media-thumb{
  appearance: none;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  border-radius: 14px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
  aspect-ratio: 4 / 3;
  position: relative;
}
.media-thumb:hover{border-color: rgba(255,255,255,.18)}
.media-thumb:active{transform: translateY(1px)}
.media-thumb img,
.media-thumb video{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: rgba(0,0,0,.18);
  pointer-events: none; /* click goes to the button wrapper */
}
.media-badge{
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .02em;
  color: rgba(255,255,255,.92);
  background: rgba(0,0,0,.42);
  border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(6px);
}
.media-openhint{
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,.86);
  background: rgba(0,0,0,.36);
  border: 1px solid rgba(255,255,255,.12);
  opacity: .9;
}
.modal-media audio{
  width: 100%;
  max-height: none;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.media-loading{
  width: min(560px, 100%);
  padding: 16px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.78);
  text-align: center;
  font-weight: 700;
}

.lightbox{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.lightbox.hidden{display:none}
.lightbox-card{
  width: min(1100px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.55);
  box-shadow: 0 40px 120px rgba(0,0,0,.55);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}
.lightbox-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.lightbox-title{
  font-weight: 850;
  color: rgba(255,255,255,.92);
  font-size: 14px;
  line-height: 1.2;
  opacity: .9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lightbox-close{
  appearance: none;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
}
.lightbox-close:hover{background: rgba(255,255,255,.10)}
.lightbox-body{
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-body img,
.lightbox-body video{
  max-width: 100%;
  max-height: calc(100vh - 170px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
}
.modal-hint{
  position: sticky;
  bottom: -14px;
  margin-top: 14px;
  text-align:center;
  color: rgba(255,255,255,.62);
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.35));
  padding-top: 10px;
}

.hint{
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 2px;
  display: none;
}

@media (max-width: 520px){
  .top{align-items:stretch; flex-direction:column}
  .actions{justify-content:stretch}
  .btn{flex:1}
  .modal{padding: 18px 12px}
  .modal-card{padding: 18px 14px 14px; max-height: calc(100vh - 80px)}
  .modal-title{font-size: 20px}
  .modal-lines{font-size: 15px}
  .modal-media{grid-template-columns: 1fr}
  .media-thumb{aspect-ratio: 16 / 11}
  .lightbox{padding: 12px}
  .lightbox-body img,.lightbox-body video{max-height: calc(100vh - 150px)}
}

/* Short screens: reduce chrome so the game canvas can fit without shrinking too much. */
@media (max-height: 760px){
  .wrap{padding: 10px 10px 12px}
  .top{padding: 10px 12px 8px}
  h1{font-size: 20px}
  .kicker{font-size: 11px}
  .stage{margin-top: 10px}
  .hint{margin-top: 10px; font-size: 12px}
}
