/* Meme Duel landing page.
   The look is the game's own: ruled notebook paper, black ink, scissor-cut corners and hard
   offset shadows (no soft glows, no gradients). Every button on the page is the same .menu-btn. */

:root {
  --night: #07090e;
  --ink: #08080b;
  --paper: #ecedf1;
  --rule: rgba(95, 130, 190, 0.34);
  --margin: rgba(230, 90, 110, 0.5);
  --gold: #ffd23a;
  --red: #ff3344;
  --mute: #4a5060;
  --cut: 14px; /* size of the scissor-cut corners */
}

body.landing-active {
  overflow-y: auto;
  background: var(--night);
}
body.landing-active #game-container { display: none; }
body.game-started #landing { display: none; }
body:not(.game-started) #game-container { display: none; }

#landing {
  position: relative;
  min-height: 100vh;
  color: var(--paper);
  font-family: var(--font-mono);
  user-select: none;
}

.ld-bg {
  position: fixed;
  inset: 0;
  background: url('../../assets/arenas/wasteland.jpg') center 62% / cover no-repeat;
  filter: saturate(0.75);
}
.ld-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 14, 0.78);
}

.ld-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(340px, 470px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 76px);
  align-items: center;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 44px clamp(24px, 4vw, 64px);
}

/* ------------------------------------------------------------ left column */
.ld-eyebrow {
  margin-bottom: 14px;
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--gold);
}

.ld-title-wrap { filter: drop-shadow(6px 6px 0 rgba(0, 0, 0, 0.6)); display: inline-block; transform: rotate(-1.6deg); }
.ld-title {
  display: block;
  padding: 4px 34px 0 44px;
  font-family: var(--font-display);
  font-size: clamp(76px, 9.4vw, 132px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 2px;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent 26px, var(--margin) 26px 28px, transparent 28px),
    repeating-linear-gradient(transparent 0 30px, var(--rule) 30px 31px),
    var(--paper);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}

.ld-tag {
  margin: 26px 0 30px;
  max-width: 400px;
  font-size: 15px;
  line-height: 1.6;
  color: #c9d3e2;
}
.ld-tag b { color: var(--gold); font-weight: normal; }

/* ------------------------------------------------------------ the one button style */
.ld-menu { display: flex; flex-direction: column; gap: 14px; list-style: none; max-width: 440px; }
.ld-menu li { filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.65)); }

.menu-btn {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: 'label key' 'sub key';
  column-gap: 16px;
  align-items: center;
  width: 100%;
  padding: 11px 16px 11px 38px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-mono);
  color: var(--ink);
  border: 0;
  background:
    linear-gradient(90deg, transparent 22px, var(--margin) 22px 24px, transparent 24px),
    repeating-linear-gradient(transparent 0 25px, var(--rule) 25px 26px),
    var(--paper);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.menu-btn .mb-label {
  grid-area: label;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 1.5px;
  line-height: 1.05;
  text-transform: uppercase;
}
.menu-btn .mb-sub { grid-area: sub; font-size: 12px; color: var(--mute); letter-spacing: 0.4px; }
.menu-btn .mb-key {
  grid-area: key;
  min-width: 28px;
  padding: 3px 7px;
  text-align: center;
  font-size: 13px;
  font-weight: bold;
  color: var(--paper);
  background: var(--ink);
}
/* the pointer or keyboard focus is marked by a solid gold edge on the left, never a box */
.menu-btn::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
  background: var(--gold);
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: none;
}
.menu-btn:hover, .menu-btn:focus-visible { transform: translateX(8px); outline: none; }
.menu-btn:focus:not(:focus-visible) { outline: none; }
.menu-btn:hover::after, .menu-btn:focus-visible::after { opacity: 1; }
.menu-btn:active { transform: translateX(8px) translateY(2px); }
.menu-btn:disabled { opacity: 0.5; cursor: wait; }
/* compact variant for dialogs: same component, less padding */
.menu-btn.compact { padding: 7px 14px 7px 38px; width: auto; min-width: 180px; }
.menu-btn.compact .mb-label { font-size: 24px; }

.ld-foot { margin-top: 26px; font-size: 12px; color: #7f93ad; letter-spacing: 0.5px; }

/* ------------------------------------------------------------ right column */
.ld-stage-wrap { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.ld-stage {
  position: relative;
  filter: drop-shadow(8px 8px 0 rgba(0, 0, 0, 0.6));
}
.ld-stage-frame {
  position: relative;
  background: var(--night);
  padding: 6px;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  background-color: var(--paper);
}
#ld-canvas { display: block; width: 100%; aspect-ratio: 16 / 10; background: #1a0f12; }

.ld-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.ld-step { border-left: 2px solid rgba(255, 255, 255, 0.18); padding-left: 14px; }
.ld-step .n { font-family: 'Permanent Marker', cursive; font-size: 30px; color: var(--gold); line-height: 1; }
.ld-step h3 { margin: 6px 0 4px; font-family: var(--font-display); font-size: 24px; letter-spacing: 1.5px; color: var(--paper); }
.ld-step p { font-size: 12px; line-height: 1.55; color: #aebbd0; }

/* ------------------------------------------------------------ dialogs */
.ld-dialog {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}
.ld-dialog::backdrop { background: rgba(5, 7, 12, 0.82); }
.ld-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  background:
    linear-gradient(90deg, transparent 38px, var(--margin) 38px 40px, transparent 40px),
    repeating-linear-gradient(transparent 0 31px, var(--rule) 31px 32px),
    var(--paper);
}
.ld-dialog header { padding: 22px 30px 6px 62px; }
.ld-dialog h2 { font-family: var(--font-display); font-size: 46px; letter-spacing: 2px; line-height: 1; }
.ld-dialog header p { margin-top: 4px; font-size: 12px; color: var(--mute); }
.ld-dialog .ld-body { padding: 10px 30px 18px 62px; overflow-y: auto; font-size: 13px; line-height: 1.6; }
.ld-dialog footer { padding: 12px 30px 22px 62px; display: flex; gap: 14px; flex-wrap: wrap; }

.ld-dialog h3 { margin: 16px 0 6px; font-family: var(--font-display); font-size: 26px; letter-spacing: 1.5px; }
.ld-dialog ul { margin-left: 18px; }
.ld-dialog li { margin: 3px 0; }
.ld-dialog table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.ld-dialog td { padding: 4px 8px 4px 0; vertical-align: top; border-bottom: 1px dashed rgba(8, 8, 11, 0.25); }
.ld-dialog td:first-child { white-space: nowrap; width: 1%; padding-right: 16px; }
kbd.key {
  display: inline-block;
  min-width: 24px;
  padding: 1px 7px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: bold;
  color: var(--paper);
  background: var(--ink);
}
.ld-dialog b { color: #8a1020; }

/* meme gallery */
.gal-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.gal-chip {
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  cursor: pointer;
  text-transform: uppercase;
}
.gal-chip.on { color: var(--paper); background: var(--ink); }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gal-card { padding: 0; text-align: left; cursor: pointer; font-family: var(--font-mono); color: var(--ink); background: var(--paper); border: 2px solid var(--ink); }
.gal-card:hover, .gal-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.gal-card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.gal-card .t { display: block; padding: 6px 8px 0; font-size: 11px; font-weight: bold; line-height: 1.25; }
.gal-card .m { display: block; padding: 2px 8px 7px; font-size: 10px; letter-spacing: 1px; color: var(--mute); text-transform: uppercase; }
.gal-player { display: none; margin-bottom: 12px; border: 2px solid var(--ink); background: #000; }
.gal-player.on { display: block; }
.gal-player video { display: block; width: 100%; max-height: 38vh; background: #000; }
.gal-player .cap { padding: 5px 10px; font-size: 12px; font-weight: bold; color: var(--paper); background: var(--ink); }

/* online lobby (shared with the game: it reuses these classes) */
.lobby-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.lobby-opt { display: flex; flex-direction: column; gap: 8px; }
.lobby-opt p { font-size: 12px; color: var(--mute); min-height: 54px; }
.lobby-code {
  font-family: var(--font-display);
  font-size: 64px;
  letter-spacing: 10px;
  line-height: 1;
  padding: 6px 12px 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: 2px dashed var(--ink);
  text-align: center;
}
.lobby-input {
  width: 100%;
  padding: 8px 10px;
  font-family: var(--font-display);
  font-size: 34px;
  letter-spacing: 8px;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid var(--ink);
  outline: none;
}
.lobby-input:focus { border-color: var(--gold); }
.lobby-status { margin-top: 12px; min-height: 22px; font-size: 13px; font-weight: bold; }
.lobby-status.err { color: #a3101f; }
.lobby-status.ok { color: #0d6b2b; }

/* ------------------------------------------------------------ small screens */
/* laptop screens (about 1366x768 and shorter): everything fits without scrolling */
@media (min-width: 921px) and (max-height: 860px) {
  .ld-shell { padding-top: 18px; padding-bottom: 18px; gap: clamp(28px, 4vw, 56px); }
  .ld-eyebrow { margin-bottom: 8px; }
  .ld-title { font-size: clamp(58px, 14vh, 104px); }
  .ld-tag { margin: 14px 0 16px; font-size: 14px; line-height: 1.5; }
  .ld-menu { gap: 9px; }
  .menu-btn { padding-top: 7px; padding-bottom: 7px; }
  .menu-btn .mb-label { font-size: 26px; }
  .ld-foot { margin-top: 12px; }
  .ld-stage-wrap { gap: 14px; }
  .ld-steps { gap: 14px; }
  .ld-step .n { font-size: 24px; }
  .ld-step h3 { font-size: 20px; }
  .ld-step p { font-size: 11px; }
}
@media (max-width: 920px) {
  .ld-shell { grid-template-columns: 1fr; min-height: 0; padding-top: 32px; padding-bottom: 40px; }
  .ld-menu { max-width: none; }
  .ld-steps { grid-template-columns: 1fr; gap: 14px; }
  .lobby-grid { grid-template-columns: 1fr; }
  .ld-dialog header, .ld-dialog .ld-body, .ld-dialog footer { padding-left: 54px; padding-right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .menu-btn, .menu-btn::after { transition: none; }
}


/* store */
.st-body { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
.st-preview { text-align: center; }
.st-frame { width: 260px; height: 260px; overflow: hidden; background: var(--ink); clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px)); }
.st-preview canvas { display: block; width: 260px; height: 260px; transform: translate(-2%, 8%) scale(1.8); transform-origin: 50% 40%; }
#st-wear { margin-top: 8px; font-size: 11px; color: var(--mute); }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.st-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; background: var(--paper); border: 2px solid var(--ink); }
.st-card.worn { box-shadow: 4px 4px 0 var(--ink); border-color: var(--ink); background: #fff7d6; }
.st-name { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; line-height: 1; color: var(--ink) !important; text-transform: uppercase; }
.st-blurb { font-size: 11px; line-height: 1.35; color: var(--mute); min-height: 30px; }
.st-btn { cursor: pointer; margin-top: 4px; padding: 5px 8px; font-family: var(--font-display); font-size: 20px; letter-spacing: 1px; color: var(--gold); background: var(--ink); border: 0; }
.st-btn.own { color: var(--paper); }
.st-btn.no { opacity: 0.4; cursor: not-allowed; }
@media (max-width: 760px) { .st-body { grid-template-columns: 1fr; } .st-frame { margin: 0 auto; } }
@media (min-width: 921px) and (max-height: 860px) { .ld-tag { margin: 10px 0 12px; } .ld-foot { display: none; } .ld-menu { gap: 7px; } .menu-btn .mb-label { font-size: 24px; } }

/* Ruled notebook paper that scrolls with the text, so every line of writing sits on a rule */
.ld-dialog .ld-body {
  background: repeating-linear-gradient(transparent 0 31px, var(--rule) 31px 32px), var(--paper);
  background-attachment: local;
  padding-top: 0;
}
#dlg-how .ld-body { line-height: 32px; font-size: 13px; padding-bottom: 0; }
#dlg-how h3 { margin: 32px 0 0; font-size: 26px; line-height: 32px; }
#dlg-how h3:first-child { margin-top: 0; }
#dlg-how ul { margin: 0 0 0 18px; }
#dlg-how li { margin: 0; }
#dlg-how table { margin: 0; border-collapse: collapse; }
#dlg-how td { padding: 0 16px 0 0; height: 32px; line-height: 32px; border: 0; vertical-align: top; }
#dlg-how kbd.key { line-height: 20px; vertical-align: 2px; margin-right: 4px; }
/* lift the rules so each line of text rests on one, like handwriting */
#dlg-how .ld-body { background-position: 0 -7px; }

.ld-start { margin-top: 16px; font-size: 13px; font-weight: bold; letter-spacing: 1.5px; color: #c9d3e2; animation: ld-blink 1.6s ease-in-out infinite; }
.ld-start kbd.key { color: var(--ink); background: var(--gold); margin: 0 4px; }
@keyframes ld-blink { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .ld-start { animation: none; } }
@media (min-width: 921px) and (max-height: 860px) { .ld-start { margin-top: 10px; } }
