/* ============ ACADEMIC STREET FIGHTER — retro CRT styling ============ */

:root {
  --bg: #0a0410;
  --panel: #160a24;
  --border: #3a1f5c;
  --yellow: #ffd83d;
  --orange: #ff7a1a;
  --red: #ff2e4c;
  --blue: #2ea8ff;
  --green: #37e05f;
  --white: #f4ecd8;
  --dim: #8f7fb0;
  --font: 'Press Start 2P', 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  overflow-x: hidden;
}

/* CRT scanlines + vignette overlay */
#crt {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.22) 0px, rgba(0,0,0,0.22) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

.hidden { display: none !important; }

.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============ buttons ============ */
.btn {
  font-family: var(--font);
  font-size: 12px;
  color: #1a0a00;
  background: linear-gradient(180deg, var(--yellow), var(--orange));
  border: 3px solid #fff2b0;
  outline: 3px solid #7a3b00;
  padding: 12px 20px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 5px 0 #7a3b00;
  transition: transform 0.05s;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #7a3b00; }
.btn:disabled { filter: grayscale(1) brightness(0.6); cursor: not-allowed; }
.btn-big { font-size: 18px; padding: 18px 42px; }
.btn-chip {
  font-size: 9px; padding: 7px 10px;
  background: var(--panel); color: var(--yellow);
  border: 2px solid var(--border); outline: none; box-shadow: 0 3px 0 #000;
}

/* ============ title screen ============ */
.title-wrap { text-align: center; padding: 24px; }
.title-small { color: var(--dim); font-size: 11px; letter-spacing: 4px; margin-bottom: 28px; }
.game-title {
  font-size: clamp(28px, 6vw, 64px);
  line-height: 1.25;
  color: var(--yellow);
  text-shadow:
    4px 4px 0 var(--red),
    8px 8px 0 #5a0a1a,
    0 0 30px rgba(255, 216, 61, 0.4);
  transform: skewY(-2deg);
  margin-bottom: 20px;
}
.title-sub { color: var(--blue); font-size: 12px; margin-bottom: 60px; letter-spacing: 2px; }
.press-start { color: var(--white); font-size: 16px; margin-bottom: 24px; }
.title-footer { margin-top: 70px; color: var(--dim); font-size: 8px; line-height: 1.8; }

/* ============ character select ============ */
#screen-select { padding: 30px 16px; justify-content: flex-start; }
.select-heading {
  font-size: clamp(16px, 3vw, 26px);
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--red);
  margin: 18px 0 26px;
}
.select-grid {
  display: grid;
  grid-template-columns: 1fr 210px 1fr;
  gap: 18px;
  width: min(1100px, 96vw);
  align-items: start;
}
.select-panel {
  background: var(--panel);
  border: 3px solid var(--border);
  box-shadow: 0 0 0 3px #000, 0 8px 0 #000;
  padding: 14px;
  min-height: 380px;
}
.select-panel.p1 { border-color: var(--red); }
.select-panel.p2 { border-color: var(--blue); }
.panel-label { font-size: 11px; margin-bottom: 12px; letter-spacing: 2px; }
.p1 .panel-label { color: var(--red); }
.p2 .panel-label { color: var(--blue); }

.search-row { display: flex; gap: 8px; }
.search-input {
  flex: 1;
  font-family: var(--font);
  font-size: 10px;
  padding: 12px 10px;
  background: #000;
  color: var(--green);
  border: 2px solid var(--border);
  caret-color: var(--green);
}
.search-input:focus { outline: 2px solid var(--yellow); }
.btn-search { font-size: 10px; padding: 10px 12px; }

/* ORCID exact-match row */
.orcid-row { display: flex; gap: 8px; margin-top: 8px; }
.orcid-input {
  flex: 1;
  font-family: var(--font);
  font-size: 8px;
  padding: 10px 8px;
  background: #000;
  color: var(--blue);
  border: 2px solid var(--border);
}
.orcid-input:focus { outline: 2px solid var(--blue); }
.btn-orcid { font-size: 8px !important; padding: 6px 10px !important; }
.orcid-hint { margin-top: 5px; font-size: 6px; color: var(--dim); line-height: 1.9; }
.orcid-base { color: var(--blue); }
.fc-orcid { font-size: 7px; color: var(--green); line-height: 1.8; margin-top: 4px; word-break: break-all; }
.fc-orcid a { color: var(--green); }
.fc-scholar-set { color: var(--green); }

/* which database settles the fight */
.src-note { font-size: 7px; line-height: 1.9; padding: 8px; border: 2px dashed var(--border); }
.src-ok { color: var(--green); }
.src-warn { color: var(--orange); }
.tape .t-src { color: var(--dim); font-size: 7px; line-height: 1.8; text-align: center; }

.results { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.result-item {
  text-align: left;
  font-family: var(--font);
  font-size: 9px;
  line-height: 1.6;
  background: #0d0518;
  color: var(--white);
  border: 2px solid var(--border);
  padding: 8px 10px;
  cursor: pointer;
}
.result-item:hover { border-color: var(--yellow); background: #1d0f30; }
.result-item .r-meta { color: var(--dim); display: block; }
.results .status { color: var(--dim); font-size: 9px; line-height: 1.8; padding: 8px 2px; }
.results .status.error { color: var(--red); }

/* fighter card */
.fighter-card { margin-top: 12px; border: 2px dashed var(--border); padding: 12px; }
.fc-top { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.fc-id { min-width: 0; }
.fc-preview {
  flex: 0 0 auto;
  width: 72px; height: 99px;
  image-rendering: pixelated;
  background: #0d0518;
  border: 2px solid var(--border);
}
.fc-note { display: block; margin-top: 6px; color: var(--dim); font-size: 6px; line-height: 1.9; }
.fc-style-notes { margin-top: 8px; font-size: 7px; color: var(--orange); line-height: 1.9; }
.fc-change { display: flex; gap: 8px; flex-wrap: wrap; }

/* style lab customization panel */
.custom-panel { margin-top: 10px; border-top: 2px dashed var(--border); padding-top: 10px; }
.custom-row {
  display: grid;
  grid-template-columns: 84px 26px 1fr 26px;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.custom-row .c-label { font-size: 7px; color: var(--dim); }
.c-arrow {
  font-family: var(--font);
  font-size: 9px;
  padding: 5px 0;
  background: #000;
  color: var(--yellow);
  border: 2px solid var(--border);
  cursor: pointer;
}
.c-arrow:hover { border-color: var(--yellow); }
.custom-row .opt-val { font-size: 7px; color: var(--white); text-align: center; }
.custom-row .swatch {
  display: block;
  height: 14px;
  border: 2px solid var(--border);
  margin: 0 auto;
  width: 60%;
}
.fc-name { font-size: 12px; color: var(--yellow); line-height: 1.5; margin-bottom: 4px; }
.fc-epithet { font-size: 9px; color: var(--orange); line-height: 1.6; margin-bottom: 6px; }
.fc-inst { font-size: 8px; color: var(--dim); line-height: 1.6; margin-bottom: 10px; }
.fc-stat { display: grid; grid-template-columns: 92px 1fr 34px; gap: 6px; align-items: center; margin-bottom: 6px; }
.fc-stat .s-label { font-size: 8px; color: var(--white); }
.fc-stat .s-val { font-size: 8px; color: var(--yellow); text-align: right; }
.statbar { height: 10px; background: #000; border: 1px solid var(--border); }
.statbar-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--yellow)); }
.fc-raw { margin-top: 10px; font-size: 7px; color: var(--dim); line-height: 1.9; }
.fc-change { margin-top: 8px; font-size: 8px; }

.vs-col { text-align: center; padding-top: 40px; display: flex; flex-direction: column; gap: 22px; align-items: center; }
.vs-text {
  font-size: 44px; color: var(--red);
  text-shadow: 3px 3px 0 var(--yellow); font-style: italic;
}
.btn-fight { background: linear-gradient(180deg, #ff5f6d, var(--red)); border-color: #ffc2cb; outline-color: #6b0012; box-shadow: 0 5px 0 #6b0012; color: #fff; }
.hint { font-size: 8px; color: var(--dim); line-height: 1.9; }

.api-row { margin-top: 22px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.api-status { font-size: 7px; line-height: 1.9; color: var(--dim); }
.api-status.ok { color: var(--green); }
.api-status.warn { color: var(--orange); }

.legends-row { margin-top: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.legends-label { font-size: 9px; color: var(--dim); }

/* ============ VS splash ============ */
#screen-vs { background: radial-gradient(circle at center, #2b0a3d 0%, var(--bg) 70%); }
.vs-splash { text-align: center; }
.vs-name { font-size: clamp(18px, 4vw, 36px); line-height: 1.4; padding: 10px 26px; }
.vs-name-1 { color: #fff; background: linear-gradient(90deg, var(--red), transparent); transform: skewX(-8deg); animation: slide-l 0.5s ease-out; }
.vs-name-2 { color: #fff; background: linear-gradient(-90deg, var(--blue), transparent); transform: skewX(-8deg); animation: slide-r 0.5s ease-out; }
.vs-big {
  font-size: clamp(50px, 10vw, 110px); color: var(--yellow);
  text-shadow: 5px 5px 0 var(--red); font-style: italic;
  margin: 16px 0; animation: vs-pop 0.4s 0.3s both;
}
.vs-tagline { margin-top: 30px; color: var(--dim); font-size: 10px; line-height: 1.9; }
@keyframes slide-l { from { transform: translateX(-70vw) skewX(-8deg); } }
@keyframes slide-r { from { transform: translateX(70vw) skewX(-8deg); } }
@keyframes vs-pop { from { transform: scale(4); opacity: 0; } }

/* ============ battle ============ */
#screen-battle { padding: 12px; }
.battle-wrap {
  width: min(1500px, 98vw);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "hud  chat"
    "arena chat"
    "comm chat";
  column-gap: 14px;
}
.hud { grid-area: hud; display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.hud-side { flex: 1; }
.hud-right { text-align: right; }
.hud-name { font-size: 10px; color: var(--yellow); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-timer { font-size: 22px; color: var(--white); text-shadow: 2px 2px 0 var(--red); }
.hpbar { height: 22px; background: #400; border: 3px solid var(--white); box-shadow: 0 0 0 2px #000; overflow: hidden; }
.hpbar-fill { height: 100%; width: 100%; background: linear-gradient(180deg, #fff87a, var(--yellow) 40%, var(--orange)); transition: width 0.35s steps(12); }
.hpbar-r .hpbar-fill { margin-left: auto; }
#arena { grid-area: arena; width: 100%; display: block; border: 3px solid var(--border); box-shadow: 0 0 0 3px #000; image-rendering: pixelated; background: #000; }
.commentary {
  grid-area: comm;
  margin-top: 10px;
  min-height: 58px;
  background: var(--panel);
  border: 3px solid var(--border);
  padding: 12px 14px;
  font-size: 10px;
  line-height: 1.9;
  color: var(--white);
}
.battle-controls {
  position: absolute; right: 0; top: -6px;
  transform: translateY(-100%);
  display: flex; gap: 8px;
}

/* --- live feed chat --- */
.chatbox {
  grid-area: chat;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  border: 3px solid var(--border);
  box-shadow: 0 0 0 3px #000;
}
.chat-title {
  font-size: 9px;
  color: var(--yellow);
  padding: 12px 12px;
  border-bottom: 3px solid var(--border);
  letter-spacing: 1px;
}
.chat-feed {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.msg {
  font-size: 8px;
  line-height: 1.8;
  padding: 8px 10px;
  border: 2px solid var(--border);
  background: #0d0518;
  max-width: 88%;
  animation: msg-in 0.25s ease-out;
}
@keyframes msg-in { from { transform: translateY(10px); opacity: 0; } }
.msg.p1 { align-self: flex-start; border-color: var(--red); border-left-width: 5px; }
.msg.p2 { align-self: flex-end; border-color: var(--blue); border-right-width: 5px; text-align: right; }
.msg.sys { align-self: center; text-align: center; color: var(--dim); border-style: dashed; max-width: 100%; }
.msg .m-year { color: var(--yellow); }
.w-badge {
  display: inline-block;
  font-size: 6px;
  padding: 1px 4px;
  border: 1px solid var(--dim);
  color: var(--dim);
  letter-spacing: 1px;
}
.w-badge.w-book, .w-badge.w-book-chapter, .w-badge.w-book-section, .w-badge.w-dissertation { border-color: #c9873a; color: #c9873a; }
.w-badge.w-review { border-color: var(--orange); color: var(--orange); }
.w-badge.w-preprint { border-color: var(--yellow); color: var(--yellow); }
.w-badge.w-conference-paper, .w-badge.w-conference-abstract, .w-badge.w-report { border-color: var(--blue); color: var(--blue); }
.w-badge.w-dataset, .w-badge.w-data-paper, .w-badge.w-software { border-color: var(--green); color: var(--green); }
.msg .m-who { color: var(--orange); }
.msg .m-title { color: var(--white); }
.msg .m-cites { color: var(--dim); }
.m-venue { display: inline-block; margin-top: 3px; font-size: 7px; color: var(--dim); }
.m-venue.t1 { color: var(--blue); }
.m-venue.t2 { color: var(--orange); }
.m-venue.t3 { color: var(--yellow); text-shadow: 0 0 6px rgba(255, 216, 61, 0.5); }
.m-vif { color: var(--dim); font-size: 6px; }
.msg .m-dmg { color: var(--red); }
.msg .m-crit { color: var(--yellow); }
.msg .m-heal { color: var(--green); }
.msg .m-miss { color: var(--dim); font-style: italic; }

/* Real (user-supplied) social post — a ranged attack */
.msg.social { background: #0d1420; border-color: #2f5a8d; }
.soc-badge { display: inline-block; background: #2ea8ff; color: #04121f; font-size: 8px; padding: 2px 4px; }
.soc-handle { color: #71a8d6; font-size: 7px; }
.soc-post { color: #c9d6e6; font-style: italic; }
.x-ratio { color: var(--red); }

/* Fictional ringside commentator (clearly not a real person) */
.msg.spectator { align-self: center; max-width: 96%; background: #05070a; border: 2px solid #2f3b45; opacity: 0.92; }
.spec-badge { display: inline-block; background: #fff; color: #000; font-size: 8px; padding: 1px 4px; }
.spec-acct { color: #e7e9ea; font-size: 8px; }
.spec-tag { color: #71767b; font-size: 7px; }
.spec-post { color: #aeb6bf; font-style: italic; }

/* social opt-in line on the fighter card */
.fc-social { margin-top: 8px; font-size: 7px; line-height: 1.9; }
.fc-social-empty { color: var(--dim); }
.fc-social-set { color: var(--blue); }
.btn-social { font-size: 7px !important; padding: 4px 7px !important; }

/* ============ victory ============ */
.victory-wrap { text-align: center; padding: 30px 16px; width: min(760px, 96vw); }
.ko-banner {
  font-size: clamp(36px, 8vw, 78px);
  color: var(--red);
  text-shadow: 6px 6px 0 var(--yellow), 0 0 40px rgba(255,46,76,0.5);
  font-style: italic;
  animation: vs-pop 0.35s both;
}
.victory-name { margin-top: 18px; font-size: clamp(14px, 3vw, 24px); color: var(--yellow); line-height: 1.6; }
.victory-pose { margin-top: 10px; font-size: 9px; color: var(--orange); letter-spacing: 1px; }
.victory-verdict { margin-top: 14px; font-size: 10px; color: var(--white); line-height: 2; }
.victory-respect {
  margin: 16px auto 0;
  max-width: 620px;
  font-size: 8px;
  color: var(--green);
  line-height: 2.1;
  border: 2px dashed var(--border);
  padding: 12px 14px;
}
.tape { margin: 26px auto 0; border-collapse: collapse; font-size: 9px; width: 100%; }
.tape th, .tape td { border: 2px solid var(--border); padding: 8px 10px; line-height: 1.5; }
.tape th { color: var(--dim); font-weight: normal; }
.tape td.win { color: var(--green); }
.tape td.lose { color: var(--dim); }
.tape .t-metric { color: var(--orange); }
.victory-btns { margin-top: 28px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ============ intro: how it works + disclaimer ============ */
/* Capped at 20% of the viewport and scrolled internally, so it never crowds
   the arcade title it sits beneath. */
.about-wrap { max-width: 620px; margin: 28px auto 0; }
.about {
  /* the caption below lives inside the same 20% budget */
  max-height: calc(20vh - 20px);
  overflow-y: auto;
  text-align: center;
  border: 2px dashed var(--border);
  background: rgba(0, 0, 0, 0.35);
  padding: 12px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  /* fade the top and bottom edges so it reads as scrollable */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
}
.about::-webkit-scrollbar { width: 6px; }
.about::-webkit-scrollbar-thumb { background: var(--border); }
.about-h {
  font-size: 8px;
  color: var(--yellow);
  letter-spacing: 1px;
  margin: 8px 0 6px;
}
.about-h:first-child { margin-top: 0; }
.about p {
  font-size: 6px;
  line-height: 2.1;
  color: var(--dim);
  margin-bottom: 8px;
}
.about p strong { color: var(--white); }
.about a { color: var(--blue); }
.about-disclaimer { color: #6f6489; }
.about-disclaimer strong { color: var(--orange); }
.about-caption {
  margin-top: 6px;
  font-size: 6px;
  color: var(--dim);
  letter-spacing: 1px;
}

/* ============ rotate-your-phone hint ============ */
#rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(10, 4, 16, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 32px;
  text-align: center;
}
#rotate-hint.hidden { display: none !important; }
.rotate-icon { font-size: 54px; animation: rotate-tip 2s ease-in-out infinite; }
@keyframes rotate-tip { 0%, 40% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }
.rotate-text { font-size: 11px; color: var(--yellow); line-height: 2; }
.rotate-sub { font-size: 8px; color: var(--dim); line-height: 2; }

/* ============ responsive ============ */
@media (max-width: 860px) {
  .select-grid { grid-template-columns: 1fr; }
  .vs-col { padding-top: 0; }
}
@media (max-width: 1100px) {
  .battle-wrap {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "hud" "arena" "comm" "chat";
  }
  .chatbox { margin-top: 12px; height: 260px; }
}

/* phone in landscape: barely any vertical room. Compress the title screen so
   START stays above the fold, and keep the info panel inside its 20% budget. */
@media (orientation: landscape) and (max-height: 480px) {
  .title-small { font-size: 7px; letter-spacing: 2px; margin-bottom: 6px; }
  .game-title { font-size: clamp(15px, 4.4vw, 30px); line-height: 1.15; margin-bottom: 6px; }
  .title-sub { font-size: 7px; margin-bottom: 10px; }
  .press-start { font-size: 9px; margin-bottom: 8px; }
  .btn-big { font-size: 11px; padding: 9px 18px; }
  .title-footer { margin-top: 10px; font-size: 5px; }
  .about-wrap { margin-top: 10px; }
  .about { padding: 8px 12px; }
  .about-h { font-size: 7px; margin: 5px 0 4px; }
  .about p { font-size: 5px; line-height: 1.9; margin-bottom: 5px; }
  .about-caption { font-size: 5px; margin-top: 4px; }
}

/* phone in landscape: short and wide. Fit the arena to the HEIGHT and put the
   feed back beside it, otherwise the fight scrolls off the bottom. */
@media (orientation: landscape) and (max-height: 560px) {
  .battle-wrap {
    grid-template-columns: minmax(0, 1fr) 220px;
    grid-template-areas: "hud chat" "arena chat" "comm chat";
  }
  #arena {
    width: auto;
    height: 54vh;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
  }
  .chatbox { margin-top: 0; height: auto; }
  .chat-title { font-size: 7px; padding: 8px; }
  .msg { font-size: 7px; }
  .commentary { font-size: 7px; line-height: 1.9; min-height: 38px; margin-top: 6px; padding: 8px; }
  .hud-name { font-size: 7px; }
  .hud-timer { font-size: 13px; }
  .hpbar { height: 15px; }
  .battle-controls { position: static; transform: none; justify-content: flex-end; margin-bottom: 6px; }
}

/* phones: the arcade title has a wide min-content width and was overflowing */
@media (max-width: 560px) {
  .title-wrap { padding: 16px 10px; }
  .game-title {
    font-size: clamp(17px, 6.6vw, 40px);
    text-shadow: 3px 3px 0 var(--red), 5px 5px 0 #5a0a1a;
  }
  .title-small { font-size: 8px; letter-spacing: 2px; }
  .title-sub { font-size: 9px; margin-bottom: 34px; }
  .press-start { font-size: 12px; }
  .title-footer { font-size: 7px; margin-top: 40px; }
  .about { margin-top: 36px; }

  .select-heading { font-size: 14px; }
  .select-panel { padding: 10px; min-height: 0; }
  .search-input { font-size: 9px; }
  .btn-big { font-size: 14px; padding: 14px 26px; }

  .battle-wrap { width: 100%; }
  .hud-name { font-size: 8px; }
  .hud-timer { font-size: 15px; }
  .commentary { font-size: 8px; line-height: 2; min-height: 48px; }
  .battle-controls { position: static; transform: none; margin-bottom: 8px; justify-content: flex-end; }
  .chatbox { height: 220px; }

  .victory-btns .btn { font-size: 10px; padding: 12px 14px; }
  .tape { font-size: 7px; }
  .tape th, .tape td { padding: 6px 4px; }
}
