/* Guild Game — 2026 glass HUD */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --glass: rgba(13, 18, 30, 0.78);
  --glass-lite: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eaf0fa;
  --dim: #93a1b8;
  --cyan: #59d0ff;
  --platinum: #dfe5ee;
  --red: #ff6b5e;
  --green: #4ade80;
}
html, body { height: 100%; overflow: hidden; background: #0b1220; color: var(--text);
  font-family: 'Inter', system-ui, sans-serif; }
h1, h2, .brand { font-family: 'Sora', sans-serif; }

#board { position: fixed; inset: 0; }
#board canvas { display: block; touch-action: none; }

.hidden { display: none !important; }
.glass { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 18px; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 15, 0.55); z-index: 50; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }

/* ---------- setup ---------- */
.setup-card { width: min(560px, 94vw); max-height: 94vh; overflow-y: auto; padding: 28px 32px; text-align: center; }
.setup-logo { width: 210px; height: 210px; border-radius: 26px; object-fit: cover; margin-bottom: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6), 0 0 0 1px var(--line); }
.swatches { display: flex; gap: 8px; margin-top: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: .15s; }
.swatch.on { border-color: #fff; transform: scale(1.15); }
.badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.badges img { width: 42px; height: 42px; object-fit: contain; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; background: var(--glass-lite); padding: 2px; transition: .15s; }
.badges img.on { border-color: var(--cyan); transform: scale(1.1); }
.pbadge { width: 20px; height: 20px; object-fit: contain; vertical-align: -5px; margin-right: 5px; border-radius: 50%; }
.setup-card h1 { font-size: 30px; letter-spacing: 2px; font-weight: 800; }
.io { color: var(--cyan); }
.tagline { color: var(--dim); margin: 4px 0 20px; }
.field { display: block; text-align: left; font-size: 13px; color: var(--dim); margin-bottom: 16px; }
.field input[type=text] { width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--glass-lite); color: var(--text); font-size: 15px; }
.field-row { display: flex; gap: 16px; } .field-row .field { flex: 1; }
.seg { display: flex; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; padding: 9px 4px; background: transparent; border: none; color: var(--dim);
  font-size: 13px; cursor: pointer; transition: .15s; }
.seg button.on { background: var(--cyan); color: #06131f; font-weight: 600; }
.hint { font-size: 12px; color: var(--dim); margin: -6px 0 14px; }
.persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.persona { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer;
  text-align: left; transition: .15s; background: var(--glass-lite); }
.persona.on { border-color: var(--persona-c, var(--cyan)); box-shadow: 0 0 0 1px var(--persona-c, var(--cyan)); }
.persona { display: flex; align-items: center; gap: 10px; }
.pface { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; }
.pbody { flex: 1; }
.persona b { display: block; color: var(--text); font-size: 14px; }
.persona i { font-style: normal; font-size: 11px; color: var(--persona-c); font-weight: 600; }
.persona span { display: block; font-size: 11px; color: var(--dim); margin-top: 3px; }
button.primary { background: linear-gradient(135deg, var(--cyan), #3b82f6); color: #06131f;
  border: none; border-radius: 12px; padding: 13px 30px; font-size: 16px; font-weight: 700;
  cursor: pointer; font-family: 'Sora'; transition: .15s; }
button.primary:hover { transform: translateY(-1px); filter: brightness(1.1); }
button.warn { background: var(--red); color: #1f0806; border: none; border-radius: 12px;
  padding: 13px 22px; font-size: 15px; font-weight: 700; cursor: pointer; }
.donate { margin-top: 16px; font-size: 12px; color: var(--dim); }

/* ---------- topbar ---------- */
#topbar { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 18px; padding: 10px 20px; white-space: nowrap; }
.brand { font-size: 15px; font-weight: 800; letter-spacing: 1px; }
#roundLabel { color: var(--platinum); font-weight: 600; font-size: 14px; }
.goalwrap { position: relative; width: 160px; height: 18px; border-radius: 9px; overflow: hidden;
  background: rgba(255,255,255,.08); }
#goalBar { position: absolute; inset: 0; width: 0%; background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width .6s ease; }
#goalText { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px #000; }
#marketLabel { font-size: 13px; color: var(--dim); }
#cashLabel { font-family: 'Sora'; font-size: 17px; font-weight: 700; color: var(--platinum); }
#muteBtn, #helpBtn { background: transparent; border: 1px solid var(--line); color: var(--text); width: 30px;
  height: 30px; border-radius: 8px; cursor: pointer; }

.how-card { padding: 26px 32px; width: min(620px, 94vw); text-align: center; }
.how-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0 22px; text-align: left; }
.how-item { background: var(--glass-lite); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.how-item b { display: block; font-size: 14px; margin-bottom: 4px; }
.how-item p { font-size: 12px; color: var(--dim); line-height: 1.5; margin: 0; }
.how-n { float: right; font-family: 'Sora'; font-weight: 800; font-size: 18px; color: var(--cyan); }
@media (max-width: 640px) { .how-grid { grid-template-columns: 1fr; } }

/* ---------- players ---------- */
#players { position: fixed; left: 14px; top: 70px; z-index: 20; display: flex; flex-direction: column; gap: 10px; }
.pcard { width: 210px; padding: 10px 14px; border-radius: 14px; background: var(--glass);
  backdrop-filter: blur(14px); border: 1px solid var(--line); border-left: 4px solid var(--pc, #fff);
  transition: .2s; }
.pcard.active { box-shadow: 0 0 0 1px var(--pc), 0 6px 24px rgba(0,0,0,.4); }
.pcard .pname { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; }
.pcard .pstyle { font-size: 10px; color: var(--dim); }
.pcard .nw { font-size: 17px; font-weight: 700; font-family: 'Sora'; margin-top: 2px; }
.pcard .sub { font-size: 11px; color: var(--dim); display: flex; gap: 10px; }
.delta-up { color: var(--green); font-size: 11px; } .delta-down { color: var(--red); font-size: 11px; }

/* ---------- feed ---------- */
#feed { position: fixed; right: 14px; top: 70px; z-index: 20; width: 230px; display: flex;
  flex-direction: column; gap: 6px; max-height: 60vh; overflow: hidden; pointer-events: none; }
.feed-item { background: var(--glass); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 11px; font-size: 12px; color: var(--dim); animation: slidein .3s ease; }
.feed-item b { color: var(--text); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- dock ---------- */
#dock { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 18px; padding: 12px 18px; min-width: 420px; max-width: 92vw; }
#tileInfo { font-size: 13px; color: var(--dim); flex: 1 1 240px; min-width: 200px; }
#tileInfo b { color: var(--text); font-size: 14px; } #tileInfo .zone { color: var(--platinum); }
.dock-actions { display: flex; gap: 10px; }

#turnBanner { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 25;
  padding: 8px 26px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); font-family: 'Sora'; font-size: 14px; font-weight: 600; }

/* ---------- drawer ---------- */
.drawer-card { width: min(760px, 95vw); max-height: 86vh; display: flex; flex-direction: column; padding: 20px 24px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.close { background: transparent; border: 1px solid var(--line); color: var(--dim); border-radius: 8px;
  width: 32px; height: 32px; cursor: pointer; }
.finance-row { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--dim); margin-bottom: 12px; }
.finance-row input[type=range] { flex: 1; max-width: 260px; accent-color: var(--cyan); }
#downLabel { min-width: 170px; color: var(--text); font-weight: 600; }
#bidRow { margin: 6px 0 4px; }
.bid-hint { font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.bid-btns { display: flex; gap: 8px; justify-content: center; }
.bid-btns button { flex: 1; max-width: 100px; padding: 9px 6px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--glass-lite); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s; }
.bid-btns button:hover:not(:disabled) { border-color: var(--platinum); transform: translateY(-1px); }
.bid-btns button:disabled { opacity: .35; cursor: default; }
.bid-tag { font-size: 11px; color: var(--platinum); min-height: 14px; margin-top: 24px; }
.building-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
  overflow-y: auto; padding-right: 4px; }
.bcard { border: 1px solid var(--line); border-radius: 14px; padding: 10px; cursor: pointer;
  background: var(--glass-lite); text-align: center; transition: .15s; }
.bcard:hover { border-color: var(--cyan); transform: translateY(-2px); }
.bcard.cant { opacity: .35; pointer-events: none; }
.bcard img { width: 84px; height: 84px; object-fit: contain; }
.bcard b { display: block; font-size: 12px; margin: 4px 0 2px; }
.bcard .cost { font-size: 12px; color: var(--platinum); font-weight: 600; }
.bcard .inc { font-size: 11px; color: var(--green); }
.bcard .syn { display: block; font-size: 10px; color: var(--platinum); margin-top: 2px; }
.bcard .syn.bad { color: var(--red); }

/* ---------- dice / event / battle ---------- */
.dice-card, .event-card, .battle-card { padding: 28px 36px; text-align: center; width: min(420px, 92vw); }
#diceFaces { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.die { width: 64px; height: 64px; border-radius: 14px; background: linear-gradient(145deg, #ffffff, #d9dde5);
  display: flex; align-items: center; justify-content: center; position: relative;
  box-shadow: 0 6px 18px rgba(0,0,0,.5), inset 0 -3px 6px rgba(0,0,0,.12); }
.pipgrid { display: grid; grid-template-columns: repeat(3, 1fr); width: 44px; height: 44px; gap: 2px; }
.pip { border-radius: 50%; }
.pip.on { background: radial-gradient(circle at 35% 30%, #3a4152, #0b1220 70%); }
.die-total { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%);
  font-family: 'Sora'; font-size: 14px; color: var(--platinum); }
.die.rolling { animation: shake .09s infinite; }
@keyframes shake { 0% { transform: rotate(-8deg) } 50% { transform: rotate(8deg) } 100% { transform: rotate(-8deg) } }
#diceResult { color: var(--dim); min-height: 20px; }
.event-card img { width: 200px; height: 200px; object-fit: contain; border-radius: 16px; }
.event-card h2 { margin: 10px 0 6px; } .event-card p { color: var(--dim); margin-bottom: 18px; }
.battle-row { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 18px 0; }
.battle-side { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; }
.vs { font-family: 'Sora'; font-weight: 800; color: var(--platinum); }
#battleResult { min-height: 22px; font-weight: 600; margin-bottom: 10px; }

/* ---------- win ---------- */
.win-card { padding: 30px 40px; text-align: center; width: min(560px, 94vw); }
.win-card h1 { font-size: 26px; margin-bottom: 14px; color: var(--platinum); }
#winVideo { width: 100%; border-radius: 14px; margin-bottom: 14px; }
#standings { text-align: left; margin-bottom: 18px; }
.standing { display: flex; justify-content: space-between; padding: 7px 12px; border-radius: 8px;
  font-size: 14px; }
.standing:first-child { background: rgba(223, 229, 238, .14); }
.standing .snw { font-weight: 700; font-family: 'Sora'; }

/* ---------- deal modal ---------- */
button.deal { background: transparent; border: 1px solid var(--platinum); color: var(--platinum);
  border-radius: 12px; padding: 13px 18px; font-size: 14px; font-weight: 700; cursor: pointer; transition: .15s; }
button.deal:hover { background: rgba(223, 229, 238, .14); }
.deal-card { padding: 26px 32px; width: min(460px, 94vw); text-align: center; }
.deal-card h2 { margin-bottom: 14px; }
#dealBody { font-size: 14px; color: var(--dim); margin-bottom: 18px; }
#dealBody .deal-line { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 0; }
#dealBody input[type=number], #dealBody select { background: var(--glass-lite); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 9px 12px; font-size: 15px; width: 160px; font-family: 'Sora'; }
#dealBody .rec { font-size: 12px; color: var(--platinum); }
#dealBody .thinking { font-size: 15px; color: var(--text); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
#dealBody .verdict-accept { color: var(--green); font-size: 16px; font-weight: 700; }
#dealBody .verdict-decline { color: var(--red); font-size: 16px; font-weight: 700; }
#dealBody .verdict-counter { color: var(--platinum); font-size: 16px; font-weight: 700; }
#dealActions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#dealActions button { min-width: 110px; }
#dealActions button.plain { background: transparent; border: 1px solid var(--line); color: var(--dim);
  border-radius: 12px; padding: 12px 18px; font-size: 14px; cursor: pointer; }
.cat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 10px 0; }
.cat-grid button { padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass-lite);
  color: var(--text); font-size: 13px; cursor: pointer; }
.cat-grid button.on { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }

/* ---------- portfolio ---------- */
.pstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.pstats div { background: var(--glass-lite); border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; }
.pstats span { display: block; font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }
.pstats b { font-family: 'Sora'; font-size: 14px; }
.plist { max-height: 42vh; overflow-y: auto; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--glass-lite); cursor: pointer; transition: .15s; }
.prow:hover { border-color: var(--cyan); transform: translateX(3px); }
.prow img { width: 40px; height: 40px; object-fit: contain; }
.prow-main { flex: 1; } .prow-main b { display: block; font-size: 13px; }
.prow-main span { font-size: 11px; color: var(--dim); }
.prow-num { text-align: right; } .prow-num b { display: block; font-size: 13px; font-family: 'Sora'; }
.prow-num span { font-size: 11px; color: var(--green); }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px);
  border-radius: 999px; padding: 8px 20px; font-size: 13px; animation: pop .25s ease; }
.toast.good { border-color: rgba(74, 222, 128, .5); } .toast.bad { border-color: rgba(255, 107, 94, .5); }
@keyframes pop { from { transform: scale(.85); opacity: 0 } to { transform: none; opacity: 1 } }

@media (max-width: 720px) {
  #topbar { top: 0; left: 0; right: 0; transform: none; width: 100vw; border-radius: 0;
    gap: 10px; padding: 8px 10px; justify-content: space-between; }
  .brand, #marketLabel { display: none; }
  .goalwrap { flex: 1; width: auto; }
  #cashLabel { font-size: 15px; }
  #players { flex-direction: row; overflow-x: auto; left: 6px; right: 6px; top: 52px; gap: 6px;
    -webkit-overflow-scrolling: touch; }
  .pcard { min-width: 140px; width: auto; padding: 8px 10px; flex-shrink: 0; }
  .pcard .nw { font-size: 14px; }
  #feed { display: none; }
  #dock { min-width: 0; width: 100vw; max-width: 100vw; left: 0; bottom: 0; transform: none;
    border-radius: 18px 18px 0 0; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  #tileInfo { flex-basis: 100%; font-size: 12px; }
  .dock-actions { width: 100%; justify-content: stretch; flex-wrap: wrap; }
  .dock-actions button { flex: 1; padding: 12px 8px; font-size: 13px; min-height: 44px; }
  .building-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
  .bcard img { width: 64px; height: 64px; }
  .drawer-card, .deal-card, .dice-card, .event-card, .battle-card, .how-card, .win-card, .setup-card {
    max-height: 92vh; overflow-y: auto; padding: 18px 16px; }
  .event-card img { width: 150px; height: 150px; }
  .bid-btns button { padding: 12px 4px; font-size: 12px; }
  .die { width: 54px; height: 54px; } .pipgrid { width: 36px; height: 36px; }
  #turnBanner { top: 108px; font-size: 12px; padding: 7px 16px; white-space: nowrap; }
  .persona-grid { grid-template-columns: 1fr; }
}

.lic, svg.lic { width: 15px; height: 15px; vertical-align: -2px; display: inline-block; stroke-width: 2.2; }
#cashLabel .lic { width: 17px; height: 17px; vertical-align: -3px; }
button .lic { pointer-events: none; }
