/* Ghost in the Wreck — single committed dark look */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: #03040a;
  color: #cfd8e8;
  font-family: "Space Mono", "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 12px 14px; pointer-events: none; z-index: 20; }
#hudLeft { display: flex; flex-direction: column; gap: 6px; }
#deckname { font-size: 12px; letter-spacing: 3px; color: #8fa3c8; text-shadow: 0 0 8px rgba(90,140,255,0.4); }
.hudlabel { font-size: 9px; letter-spacing: 2px; color: #66738c; }
.hudlabel.sep { margin-left: 10px; }
#o2wrap { display: flex; align-items: center; gap: 8px; }
#o2track { width: 140px; height: 8px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12); border-radius: 4px; overflow: hidden; }
#o2fill { height: 100%; width: 100%; background: linear-gradient(90deg,#57c7ff,#8ef0e0); transition: width 0.4s; }
#invwrap { font-size: 11px; color: #b8c6de; }
#hudRight { display: flex; gap: 8px; align-items: flex-start; pointer-events: auto; }
.hudbtn { background: rgba(10,14,24,0.7); color: #94a7c4; border: 1px solid rgba(140,170,220,0.25); font: inherit; font-size: 10px; letter-spacing: 2px; padding: 7px 10px; cursor: pointer; border-radius: 3px; }
.hudbtn:hover { color: #dfe9ff; border-color: rgba(160,200,255,0.6); }

#soundPanel { position: fixed; top: 54px; right: 14px; z-index: 30; background: rgba(8,12,22,0.95); border: 1px solid rgba(140,170,220,0.35); border-radius: 5px; padding: 12px 14px; display: none; flex-direction: column; gap: 9px; width: 210px; }
#soundPanel.show { display: flex; }
.mixrow { display: flex; align-items: center; gap: 8px; font-size: 9px; letter-spacing: 1.5px; color: #8fa3c8; }
.mixrow span { width: 64px; }
.mixrow input[type=range] { flex: 1; accent-color: #b98aff; height: 4px; }
#btnMuteAll { padding: 7px 10px; font-size: 10px; }

#toasts { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 25; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: rgba(8,12,22,0.85); border: 1px solid rgba(140,170,220,0.25); padding: 7px 14px; font-size: 12px; border-radius: 3px; color: #b9c8e2; transition: opacity 1s; }
.toast.fade { opacity: 0; }

#subtitle { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); max-width: min(640px, 88vw); background: rgba(6,8,18,0.82); border-left: 3px solid #b98aff; padding: 10px 16px; font-size: 14px; line-height: 1.5; z-index: 22; opacity: 0; transition: opacity 0.6s; pointer-events: none; }
#subtitle.show { opacity: 1; }
#subwho { color: #c9a6ff; font-size: 10px; letter-spacing: 3px; display: block; margin-bottom: 3px; }
#subtext { color: #e6dcf7; }

#interactBtn { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: rgba(14,20,34,0.9); color: #d8e6ff; border: 1px solid rgba(160,200,255,0.5); font: inherit; font-size: 12px; letter-spacing: 2px; padding: 12px 22px; border-radius: 4px; cursor: pointer; display: none; z-index: 21; box-shadow: 0 0 18px rgba(90,140,255,0.25); }
#interactBtn.show { display: block; }
#interactBtn:hover { background: rgba(24,34,54,0.95); }

#joyzone { position: fixed; bottom: 24px; left: 24px; width: 110px; height: 110px; border-radius: 50%; border: 1px solid rgba(140,170,220,0.2); background: rgba(10,14,24,0.35); display: none; z-index: 21; }
#joyzone.live { border-color: rgba(160,200,255,0.5); }
#joyknob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(120,150,210,0.35); border: 1px solid rgba(160,200,255,0.4); }
body.touch #joyzone { display: block; }
body.touch #subtitle { bottom: 160px; }
body.touch #interactBtn { bottom: 40px; left: auto; right: 20px; transform: none; }
@media (max-width: 520px) {
  #hudRight .hudbtn { padding: 6px 7px; font-size: 9px; }
  #o2track { width: 100px; }
}

/* ---------------- overlays ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(2,3,8,0.78); display: none; align-items: center; justify-content: center; z-index: 40; backdrop-filter: blur(2px); }
.overlay.show { display: flex; }

.panel { width: min(680px, 94vw); max-height: 86vh; overflow-y: auto; background: #070a14; border: 1px solid rgba(140,170,220,0.3); border-radius: 6px; padding: 18px 20px 16px; box-shadow: 0 0 50px rgba(20,40,90,0.5); }
.panel.small { width: min(520px, 92vw); }
.panel.dark { background: #05060c; }
.crt { position: relative; }
.crt::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 3px); border-radius: 6px; }
.panelhead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; letter-spacing: 3px; color: #9fe8cf; margin-bottom: 10px; text-shadow: 0 0 10px rgba(80,240,180,0.35); }
.xbtn { background: none; border: none; color: #6c7c9c; font-size: 22px; cursor: pointer; line-height: 1; }
.xbtn:hover { color: #fff; }
.dim { color: #66738c; font-size: 11px; line-height: 1.5; }
.bodytext { font-size: 14px; line-height: 1.65; color: #cfe6da; margin: 12px 0; min-height: 90px; white-space: pre-wrap; }
.panelbtns { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.pbtn { background: rgba(30,60,50,0.4); color: #a9f0d4; border: 1px solid rgba(120,240,190,0.35); font: inherit; font-size: 11px; letter-spacing: 2px; padding: 10px 14px; cursor: pointer; border-radius: 3px; }
.pbtn:hover:not(:disabled) { background: rgba(40,90,70,0.5); }
.pbtn:disabled { opacity: 0.4; cursor: default; }
.pbtn.ghost { background: transparent; color: #8296b6; border-color: rgba(140,170,220,0.3); }
.fineprint { margin-top: 12px; font-size: 10px; color: #4d5a72; line-height: 1.5; }
.fineprint2 { font-size: 10px; line-height: 1.6; }

.echolinewrap { margin: 10px 0 4px; }
.echotag { color: #c9a6ff; font-size: 10px; letter-spacing: 3px; }
.echoline { font-size: 14.5px; line-height: 1.6; color: #e8ddfa; min-height: 44px; margin-top: 4px; }
.echoline.big { font-size: 16px; min-height: 70px; }
.echoline.reply { color: #cbb8ee; min-height: 60px; margin: 8px 0; }

.inputrow { display: flex; gap: 8px; margin-top: 12px; }
.inputrow input { flex: 1; background: #0b0f1c; border: 1px solid rgba(140,170,220,0.35); color: #e6efff; font: inherit; font-size: 14px; padding: 11px 12px; border-radius: 3px; outline: none; }
.inputrow input:focus { border-color: rgba(180,220,255,0.7); box-shadow: 0 0 12px rgba(90,140,255,0.2); }

.bars { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 5px; }
.barrow { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.barname { width: 88px; color: #8296b6; letter-spacing: 1px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barname.target { color: #ffd76a; }
.bartrack { flex: 1; height: 10px; background: rgba(255,255,255,0.06); border-radius: 5px; overflow: hidden; }
.barfill { display: block; height: 100%; background: linear-gradient(90deg,#7a5cff,#b98aff); border-radius: 5px; transition: width 0.5s; }
.barpct { width: 44px; color: #9daecb; }
.verdict { margin: 8px 0; font-size: 12px; letter-spacing: 1px; min-height: 18px; }
.verdict.good { color: #7cffbe; text-shadow: 0 0 10px rgba(80,255,180,0.4); }
.verdict.bad { color: #ff8f7c; }
.hintline { color: #c9b98a; font-size: 12.5px; font-style: italic; margin-top: 5px; }

#comLog { max-height: 46vh; min-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding: 6px 2px; }
.comyou { color: #9fc5ff; font-size: 13px; }
.comecho { color: #e0d3f7; font-size: 13.5px; line-height: 1.55; }
.comvp { font-size: 10px; }

#journalBody { max-height: 60vh; overflow-y: auto; margin-top: 10px; }
.jentry { border-left: 2px solid rgba(140,170,220,0.3); padding: 4px 12px; margin-bottom: 14px; }
.jtitle { font-size: 12px; color: #ffd76a; letter-spacing: 1px; margin-bottom: 4px; }
.jtext { font-size: 12.5px; line-height: 1.6; color: #b9c8e2; }

/* ---------------- title / crawls / ending ---------------- */
.titlebox { text-align: center; max-width: 92vw; }
.pretitle { color: #66738c; font-size: 11px; letter-spacing: 2px; margin-bottom: 18px; }
.titlebox h1 { font-size: clamp(38px, 8vw, 74px); line-height: 1.02; letter-spacing: 6px; color: #e8eeff; text-shadow: 0 0 30px rgba(120,150,255,0.5), 0 0 80px rgba(90,60,180,0.4); font-weight: 700; }
.subtitle2 { color: #b98aff; font-size: 13px; letter-spacing: 2px; margin: 16px 0 30px; }
.titlebtns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.bigbtn { background: rgba(20,26,44,0.85); color: #dfe9ff; border: 1px solid rgba(160,200,255,0.45); font: inherit; font-size: 13px; letter-spacing: 3px; padding: 15px 26px; cursor: pointer; border-radius: 4px; }
.bigbtn:hover { background: rgba(34,44,72,0.95); box-shadow: 0 0 20px rgba(90,140,255,0.3); }
.bigbtn.ghost { background: transparent; color: #8296b6; }
#loadstatus { color: #5d84a8; font-size: 11px; letter-spacing: 1px; min-height: 16px; }
.titlehelp { color: #4d5a72; font-size: 10px; margin-top: 14px; letter-spacing: 1px; }

.crawlbox { max-width: min(620px, 90vw); text-align: center; cursor: pointer; }
.crawltext { font-size: clamp(15px, 2.4vw, 19px); line-height: 1.8; color: #d7e0f2; min-height: 110px; }
.decktitle { font-size: 13px; letter-spacing: 6px; color: #8fa3c8; margin-bottom: 18px; }
.clickhint { color: #4d5a72; font-size: 10px; letter-spacing: 2px; margin-top: 26px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.endingbox { max-width: min(640px, 92vw); text-align: center; max-height: 92vh; overflow-y: auto; padding: 10px; }
#endingTitle { font-size: clamp(22px, 4vw, 34px); letter-spacing: 6px; color: #e8eeff; margin-bottom: 24px; text-shadow: 0 0 30px rgba(150,110,255,0.5); min-height: 40px; }
.eframe { font-size: 14.5px; line-height: 1.75; color: #cdd8ec; margin-bottom: 16px; }
#endingCoda { color: #b98aff; font-size: 13.5px; line-height: 1.7; margin: 20px 0; font-style: italic; }
#endingStats { margin-bottom: 20px; }

.corepanel { border-color: rgba(190,140,255,0.4); box-shadow: 0 0 60px rgba(120,60,200,0.35); }
.about p { margin-bottom: 12px; }

/* short viewports (landscape phones, on-screen keyboards) */
@media (max-height: 540px) {
  .panel { max-height: 96vh; padding: 10px 14px; }
  .echoline.big { min-height: 40px; font-size: 14px; }
  .echoline { min-height: 28px; }
  .fineprint { display: none; }
  .bodytext { min-height: 50px; }
}
@media (max-width: 520px) {
  .endingbox { padding-bottom: 48px; }
  .eframe { font-size: 13px; line-height: 1.6; }
  #endingTitle { letter-spacing: 3px; }
}

/* ---------------- iteration 2 prototype ---------------- */
#toasts { z-index: 60; }
body.drain #hud { z-index: 55; }
body.drain #hudRight { visibility: hidden; }
body.drain .overlay { padding-top: 64px; }
#echoMood { display: flex; align-items: center; gap: 7px; font-size: 10px; letter-spacing: 2px; }
#echoMood .eye { width: 9px; height: 9px; border-radius: 50%; background: #6fe3c8; box-shadow: 0 0 8px #6fe3c8; transition: background 0.6s, box-shadow 0.6s; }
#moodLabel { color: #8fd8c6; min-width: 84px; }
#moodTrack { width: 60px; height: 4px; background: rgba(255,255,255,0.07); border-radius: 2px; overflow: hidden; }
#moodFill { height: 100%; width: 0; background: #6fe3c8; transition: width 0.5s, background 0.6s; }
.mood-wary .eye, .mood-wary #moodFill { background: #e8d36a; box-shadow: 0 0 8px #e8d36a; }
.mood-wary #moodLabel { color: #e8d36a; }
.mood-suspicious .eye, .mood-suspicious #moodFill { background: #ff9a4a; box-shadow: 0 0 10px #ff9a4a; }
.mood-suspicious #moodLabel { color: #ff9a4a; }
.mood-hostile .eye, .mood-hostile #moodFill { background: #ff4b4b; box-shadow: 0 0 14px #ff4b4b; animation: moodpulse 0.9s infinite; }
.mood-hostile #moodLabel { color: #ff6b6b; }
@keyframes moodpulse { 50% { opacity: 0.4; } }
.hudbtn.report { color: #d7b8ff; border-color: rgba(185,138,255,0.45); }
.doormeta { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 2px; color: #7f8cab; margin: 8px 0 2px; min-height: 14px; }
.timer { color: #ffb36b; }
.timer.hot { color: #ff5b5b; animation: moodpulse 0.6s infinite; }
.layers { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.layer { font-size: 10.5px; letter-spacing: 0.5px; padding: 4px 8px; border: 1px solid rgba(140,170,220,0.25); border-radius: 3px; color: #9aa9c6; }
.layer.ok { color: #7cffbe; border-color: rgba(124,255,190,0.45); }
.layer.no { color: #ff8f7c; border-color: rgba(255,143,124,0.5); }
.hintline.source { color: #9fd0ff; font-style: normal; }
mark { background: rgba(255,214,120,0.16); color: #ffe1a0; padding: 0 2px; border-radius: 2px; }
mark.faint { background: transparent; color: inherit; }
.jtag { font-size: 9px; letter-spacing: 1.5px; color: #ffd78a; border: 1px solid rgba(255,215,138,0.4); border-radius: 2px; padding: 1px 5px; margin-right: 7px; vertical-align: 1px; }
.jtag.keep { color: #c9a6ff; border-color: rgba(201,166,255,0.45); }
.keepsaketext { white-space: pre-line; }
#noteEcho { margin-top: 10px; min-height: 0; }
.reportsum { white-space: pre-wrap; font: inherit; font-size: 11.5px; line-height: 1.6; color: #c4d2ea; background: #0a0e1a; border: 1px solid rgba(140,170,220,0.2); padding: 10px 12px; margin: 10px 0; border-radius: 3px; overflow-x: auto; }
.reportcode { width: 100%; background: #0b0f1c; color: #9fb4d8; border: 1px solid rgba(140,170,220,0.3); font: inherit; font-size: 10px; padding: 8px; border-radius: 3px; resize: none; word-break: break-all; }
#doorReply { min-height: 0; font-style: italic; margin: 2px 0 6px; }
[hidden] { display: none !important; }
