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

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: #000000; /* 加算式ディスプレイでは透明＝現実の景色が透ける */
  color: #FFFFFF;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  user-select: none;
}

:root { --ok: #7bffb0; --sel: #ffd166; --acc: #7ce7ff; --ng: #ff8a8a; }

#app { position: relative; width: 600px; height: 600px; }
.hidden { display: none !important; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; left: 0; top: 0; width: 600px; height: 40px; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  font-size: 19px; font-weight: 700; color: #e6e9f0;
}
#hud-right { color: #9aa3b5; font-variant-numeric: tabular-nums; font-size: 17px; }
#hud-right b { color: var(--acc); font-size: 20px; }
#tbar { position: absolute; left: 16px; top: 38px; width: 568px; height: 4px; border-radius: 2px; background: #1a1d24; z-index: 2; }
#tbar i { display: block; height: 100%; width: 100%; border-radius: 2px; background: var(--acc); transition: width 200ms linear; }
#tbar i.low { background: var(--ng); }

/* ---------- タイトル ---------- */
.logo { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 6px; }
.logo .d {
  width: 40px; height: 50px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: #1c1f27; border: 2px solid #2e3340;
  font-size: 30px; font-weight: 800; color: #eef1f6;
}
.logo .arrow { font-size: 26px; color: #7c8496; margin: 0 4px; }
.logo .ten { font-size: 44px; font-weight: 900; color: var(--ok); text-shadow: 0 0 16px rgba(123,255,176,0.6); }
.t-title { font-size: 34px; font-weight: 800; margin-bottom: 2px; }

/* ---------- ゲーム ---------- */
#game { justify-content: flex-start; padding-top: 50px; }
#info { width: 568px; height: 104px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
#ticket { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 700; color: #9aa3b5; }
#ticket .tk {
  display: flex; gap: 6px; padding: 3px 12px;
  border: 2px dashed #3a404c; border-radius: 8px;
  font-size: 22px; font-weight: 800; color: #dfe4ee; letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
#ticket .star { color: var(--sel); letter-spacing: 1px; }

#status {
  width: 568px; height: 50px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: #121419; border: 2px solid #22262f;
  font-size: 24px; font-weight: 800; color: #eef1f6; white-space: nowrap; overflow: hidden;
  font-variant-numeric: tabular-nums;
}
#status .q { color: var(--acc); }
#status .s { color: var(--sel); }
#status .dim { color: #9aa3b5; font-size: 19px; }
#status.win { border-color: var(--ok); color: var(--ok); box-shadow: 0 0 18px rgba(123,255,176,0.35); }
#status.tip { border-color: var(--sel); color: var(--sel); font-size: 21px; }

#cards { margin-top: 14px; height: 168px; display: flex; gap: 14px; align-items: center; justify-content: center; }
.card {
  width: 122px; height: 156px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #171a21; border: 3px solid #2e3340;
  position: relative; cursor: pointer;
  transition: transform 140ms, border-color 140ms, opacity 140ms;
  font-variant-numeric: tabular-nums;
}
.card .v { font-size: 66px; font-weight: 800; color: #eef1f6; line-height: 1; }
.card .v.neg { color: #ffb3b3; }
.card .fr { display: flex; flex-direction: column; align-items: center; font-size: 36px; font-weight: 800; color: #eef1f6; line-height: 1.05; }
.card .fr i { display: block; width: 64px; height: 3px; background: #eef1f6; margin: 3px 0; }
.card .ex { position: absolute; bottom: 8px; left: 4px; right: 4px; text-align: center; font-size: 14px; font-weight: 700; color: #7c8496; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.cur { transform: scale(1.07); border-color: var(--acc); box-shadow: 0 0 18px rgba(124,231,255,0.45); }
.card.sel { border-color: var(--sel); background: #241f10; box-shadow: 0 0 18px rgba(255,209,102,0.45); }
.card.sel::before {
  content: "えらび中"; position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  padding: 1px 8px; border-radius: 999px; background: var(--sel); color: #1a1406;
  font-size: 13px; font-weight: 800; white-space: nowrap;
}
.card.dim { opacity: 0.45; }
.card.tip { outline: 3px dashed var(--sel); outline-offset: 4px; }
.card.win { border-color: var(--ok); background: #10241a; box-shadow: 0 0 30px rgba(123,255,176,0.6); }
.card.win .v { color: var(--ok); }
.card.bad { border-color: var(--ng); }
.card.pop { animation: pop 360ms ease-out; }
@keyframes pop { from { transform: scale(1.25); border-color: var(--sel); } to { transform: scale(1); } }

#ops { margin-top: 12px; display: flex; gap: 12px; }
.op {
  width: 84px; height: 66px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: #171a21; border: 3px solid #2e3340;
  font-size: 40px; font-weight: 800; color: #dfe4ee;
  cursor: pointer; opacity: 0.35;
  transition: transform 120ms, border-color 120ms, opacity 120ms;
}
.op.x { font-size: 18px; color: #aab2c2; }
.op.on { opacity: 1; }
.op.chosen { border-color: var(--sel); color: var(--sel); opacity: 1; }
.op.cur { transform: scale(1.08); border-color: var(--acc); box-shadow: 0 0 18px rgba(124,231,255,0.45); opacity: 1; }

#acts { margin-top: 16px; display: flex; gap: 12px; }
.act {
  width: 176px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: #1c1f27; border: 2px solid #2e3340;
  font-size: 19px; font-weight: 700; color: #dfe4ee;
  cursor: pointer; opacity: 0.75;
  transition: transform 120ms, border-color 120ms, opacity 120ms;
}
.act.cur { opacity: 1; transform: scale(1.04); border-color: var(--acc); box-shadow: 0 0 18px rgba(124,231,255,0.35); }

#toast {
  position: absolute; z-index: 3; left: 50%; top: 372px; transform: translateX(-50%);
  padding: 10px 24px; border-radius: 999px;
  background: #1c1f27; border: 2px solid var(--sel); color: var(--sel);
  font-size: 24px; font-weight: 800; white-space: nowrap;
  opacity: 0; transition: opacity 200ms; pointer-events: none;
}
#toast.on { opacity: 1; }
#toast.good { border-color: var(--ok); color: var(--ok); background: #10241a; font-size: 30px; }
#hint {
  position: absolute; left: 0; bottom: 0; width: 600px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #aab2c2;
}

/* ---------- 共通パネル・ボタン ---------- */
.panel {
  width: 480px;
  padding: 18px 24px 22px;
  border-radius: 18px;
  background: #14161c;
  border: 2px solid #2e3340;
  text-align: center;
}
.panel.wide { width: 556px; }
.t-title.small { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.t-sub { font-size: 16px; color: #9aa3b5; margin: 2px 0 14px; min-height: 20px; line-height: 1.5; }
.t-sub .ans { display: inline-block; margin: 4px 0; font-size: 28px; font-weight: 800; color: var(--ok); white-space: nowrap; }
.t-sub .big { font-size: 34px; font-weight: 800; color: var(--acc); }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.rail-btn {
  padding: 9px 14px;
  border-radius: 12px;
  background: #1c1f27;
  border: 2px solid #2e3340;
  font-size: 21px; font-weight: 700; color: #dfe4ee;
  opacity: 0.75;
  display: flex; justify-content: space-between; align-items: center;
  transition: transform 160ms cubic-bezier(0.6, 0, 0.4, 1), border-color 160ms, opacity 160ms;
  cursor: pointer;
}
.rail-btn small { font-size: 15px; color: #9aa3b5; font-weight: 700; }
.rail-btn.off span { color: #6a7282; }
.rail-btn.cur {
  opacity: 1; transform: scale(1.03);
  border-color: var(--acc);
  box-shadow: 0 0 18px rgba(124, 231, 255, 0.35);
}

/* ---------- つかいかた ---------- */
.howto { text-align: left; list-style: none; margin: 0 0 14px; }
.howto li { font-size: 17px; line-height: 1.55; color: #dfe4ee; padding-left: 14px; position: relative; }
.howto li::before { content: "・"; position: absolute; left: 0; color: var(--acc); }
.howto b.key { color: var(--acc); }
.howto b.ok { color: var(--ok); }
.howto b.sel { color: var(--sel); }
