:root {
  --red: #e31823;
  --deep: #850b15;
  --darker: #59050c;
  --paper: #fffaf6;
  --cream: #f3e9e2;
  --ink: #302a2c;
  --muted: #7e7376;
  --line: rgba(110, 24, 32, .13);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 80% -10%, rgba(255,255,255,.13), transparent 32%),
    linear-gradient(145deg, #650811, #ab101b 48%, #720912);
  -webkit-tap-highlight-color: transparent;
}
button, a { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1240px, calc(100% - 30px)); margin: 0 auto; padding: 20px 0 16px; }
.hero {
  min-height: 128px; padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; gap: 22px;
  color: #fff; border: 1px solid rgba(255,255,255,.16); border-bottom: 0; border-radius: 24px 24px 0 0;
  background: linear-gradient(112deg, #5a050d 0%, #a70d19 55%, #d21520 100%);
  position: relative; overflow: hidden;
}
.hero::after { content:""; position:absolute; width:330px; height:330px; right:18%; top:-255px; border:38px solid rgba(255,255,255,.055); border-radius:50%; }
.brand { min-width: 0; display: flex; align-items: center; gap: 23px; position: relative; z-index: 1; }
.brand img { width: min(325px, 29vw); height: auto; object-fit: contain; }
.title-block { padding-left: 23px; border-left: 1px solid rgba(255,255,255,.35); }
.title-block > span, .kicker { display: block; margin-bottom: 5px; color: inherit; font-size: 10px; font-weight: 800; letter-spacing: .2em; opacity: .76; }
.title-block h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: .07em; line-height: 1.15; }
.title-block p { margin: 7px 0 0; color: rgba(255,255,255,.72); font-size: 12px; }
.website-link { min-width: 205px; padding: 12px 43px 12px 16px; color: var(--deep); text-decoration: none; border-radius: 12px; background: #fff; box-shadow: 0 8px 22px rgba(59,0,6,.22); position: relative; z-index: 2; transition: .18s; }
.website-link:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(59,0,6,.3); }
.website-link span, .website-link b { display:block; }
.website-link span { font-size: 12px; font-weight: 800; }
.website-link b { margin-top: 2px; color: var(--red); font-size: 14px; }
.website-link i { position:absolute; right:16px; top:50%; transform:translateY(-50%); color:var(--red); font-style:normal; font-size:20px; }

.game-card { border-radius: 0 0 24px 24px; background: var(--paper); box-shadow: 0 25px 70px rgba(45,0,5,.35); overflow:hidden; }
.topbar { min-height: 78px; padding: 12px 22px; display:flex; align-items:center; gap:14px; border-bottom:1px solid var(--line); background:#f3e9e3; }
.metric { min-width: 118px; padding: 3px 15px; border-right:1px solid var(--line); }
.metric span, .metric small { color:var(--muted); font-size:10px; }
.metric span { display:block; margin-bottom:3px; }
.metric strong { color:var(--deep); font:800 22px/1.2 ui-monospace, Consolas, monospace; letter-spacing:.04em; }
.metric small { margin-left:4px; }
.mode-badge { margin-right:auto; padding:8px 13px; color:#a36409; border:1px solid rgba(179,117,20,.2); border-radius:999px; background:#fff8e6; font-size:12px; font-weight:800; }
.mode-badge span { color:#f6a800; }
.audio-switches { display:flex; gap:7px; }
.audio-switches button { padding:9px 12px; color:var(--deep); border:1px solid var(--line); border-radius:9px; background:#fff; font-size:12px; }
.audio-switches button[aria-pressed="false"] { color:#aaa1a3; background:#e8dfdc; text-decoration:line-through; }

.play-layout { padding:22px; display:grid; grid-template-columns:minmax(0,1fr) 238px; gap:20px; align-items:start; }
.board-section { min-width:0; }
.board-heading { min-height:42px; display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.board-heading > div, .panel-title { display:flex; align-items:center; gap:9px; }
.board-heading strong { font-size:14px; }
.board-heading p { margin:2px 0 0; color:var(--muted); font-size:12px; }
.board-heading p.good { color:#af101b; font-weight:800; }
.board-heading p.bad { color:#b27516; font-weight:800; }
.step-dot { width:25px; height:25px; display:grid; place-items:center; flex:0 0 auto; color:#fff; border-radius:50%; background:var(--red); font:800 12px/1 ui-monospace, monospace; }

.board {
  width:100%; max-width:820px; aspect-ratio:1.42; margin:0 auto; position:relative; overflow:hidden;
  border:1px solid rgba(109,27,34,.12); border-radius:18px;
  background:
    radial-gradient(circle at 50% 46%, rgba(255,255,255,.92), rgba(255,255,255,.55) 58%, transparent 59%),
    repeating-linear-gradient(45deg, #eee4dd 0 7px, #f7f0eb 7px 14px);
  box-shadow:inset 0 0 36px rgba(110,23,31,.07), 0 8px 21px rgba(77,9,15,.08);
}
.board::before { content:"PLSUN"; position:absolute; inset:0; display:grid; place-items:center; color:rgba(130,40,47,.035); font:900 clamp(70px,12vw,150px)/1 Arial; letter-spacing:.05em; }
.card-tile {
  position:absolute; width:18.4%; aspect-ratio:1; padding:0; border:1px solid rgba(91,48,51,.18); border-radius:11px;
  background:#e8e7e6; box-shadow:0 5px 11px rgba(63,30,32,.19), inset 0 1px rgba(255,255,255,.9);
  overflow:hidden; transform-origin:center; transition:transform .16s ease, filter .16s ease, opacity .22s ease, box-shadow .16s ease;
}
.card-tile img { display:block; width:100%; height:100%; object-fit:cover; pointer-events:none; }
.card-tile.available:hover { transform:scale(1.025); border-color:var(--red); box-shadow:0 8px 17px rgba(116,12,20,.22), 0 0 0 2px rgba(227,24,35,.13); z-index:1000!important; }
.card-tile.blocked { cursor:not-allowed; filter:saturate(.44) brightness(.78); }
.card-tile.blocked::after { content:""; position:absolute; inset:0; background:rgba(78,52,54,.14); }
.card-tile.shake { animation:shake .28s ease; }
.card-tile.picked { opacity:0; transform:translateY(12px) scale(.72); pointer-events:none; }

.side-panel { min-width:0; display:grid; gap:13px; }
.tray-panel, .rescue-panel, .power-panel { padding:15px; border:1px solid var(--line); border-radius:14px; background:#f4ebe5; }
.panel-title { margin-bottom:12px; }
.panel-title > div { display:flex; flex-direction:column; gap:2px; }
.panel-title strong { font-size:14px; }
.panel-title small { color:var(--muted); font-size:10px; }
.panel-title.compact { justify-content:space-between; }
.panel-title.compact span, .panel-title.compact strong { font-size:12px; }
.tray { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; min-height:111px; }
.slot { aspect-ratio:1; border:1px dashed rgba(117,54,59,.22); border-radius:8px; background:rgba(255,255,255,.62); overflow:hidden; position:relative; }
.slot.filled { border-style:solid; background:#e9e8e7; animation:slotIn .2s ease; }
.slot img, .rescue-card img { width:100%; height:100%; object-fit:cover; display:block; }
.slot.matching { box-shadow:0 0 0 3px rgba(227,24,35,.25); }
.slot.clearing { animation:clear .36s ease forwards; }
.slot-meter { height:5px; margin-top:10px; border-radius:999px; background:rgba(113,39,44,.12); overflow:hidden; }
.slot-meter span { display:block; width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,#e51823,#ff8a34); transition:width .2s; }
.rescue { display:flex; gap:7px; }
.rescue-card { width:52px; aspect-ratio:1; padding:0; border:1px solid rgba(188,116,14,.25); border-radius:8px; background:#fff3d4; overflow:hidden; }
.rescue-card:hover { transform:translateY(-2px); }
.powers { display:grid; gap:7px; }
.powers button { min-height:51px; padding:7px 30px 7px 9px; display:grid; grid-template-columns:30px 1fr; grid-template-rows:auto auto; column-gap:7px; text-align:left; color:var(--ink); border:1px solid rgba(105,38,44,.12); border-radius:10px; background:#fff; position:relative; transition:.16s; }
.powers button:hover:not(:disabled) { color:var(--red); transform:translateX(2px); border-color:rgba(227,24,35,.3); }
.powers button:disabled { opacity:.42; cursor:not-allowed; }
.power-icon { grid-row:1/3; align-self:center; color:var(--red); font-size:22px; text-align:center; }
.powers b { font-size:12px; }
.powers small { color:var(--muted); font-size:9px; }
.powers em { position:absolute; right:8px; top:50%; transform:translateY(-50%); width:20px; height:20px; display:grid; place-items:center; color:#fff; border-radius:50%; background:var(--red); font:800 10px/1 ui-monospace,monospace; }
.restart-btn { padding:10px; color:var(--muted); border:1px solid var(--line); border-radius:10px; background:transparent; font-size:11px; }

footer { padding:13px 8px 0; display:flex; justify-content:space-between; color:rgba(255,255,255,.58); font-size:11px; }
footer a { color:#fff; text-decoration:none; font-weight:800; }

.modal { position:fixed; inset:0; z-index:5000; padding:18px; display:grid; place-items:center; background:rgba(48,0,6,.7); backdrop-filter:blur(8px); opacity:0; visibility:hidden; transition:.25s; }
.modal.show { opacity:1; visibility:visible; }
.modal-card { width:min(470px,100%); padding:39px; text-align:center; border:1px solid rgba(255,255,255,.7); border-radius:24px; background:#fffaf6; box-shadow:0 28px 90px rgba(32,0,4,.38); transform:translateY(12px) scale(.98); transition:.25s; }
.modal.show .modal-card { transform:none; }
.modal-card .kicker { color:var(--red); opacity:1; }
.modal-card h2 { margin:8px 0 12px; color:var(--deep); font-size:29px; }
.modal-card > p { margin:0 auto; max-width:370px; color:#71676a; font-size:13px; line-height:1.8; }
.rule-row { margin:23px 0; display:grid; grid-template-columns:repeat(3,1fr); border-block:1px solid var(--line); }
.rule-row span { padding:12px 4px; color:var(--muted); font-size:11px; }
.rule-row span + span { border-left:1px solid var(--line); }
.rule-row b { display:block; color:var(--red); font:800 22px/1.2 ui-monospace,monospace; }
.primary-btn { min-width:205px; padding:13px 22px; color:#fff; border:0; border-radius:999px; background:linear-gradient(135deg,var(--red),#b00e18); box-shadow:0 9px 22px rgba(196,14,25,.3); font-weight:800; cursor:pointer; transition:.18s; }
.primary-btn:hover { transform:translateY(-2px); }
.primary-btn span { margin-left:10px; }
.start-card > a { display:block; width:max-content; margin:17px auto 0; color:var(--red); font-size:12px; font-weight:800; text-decoration:none; }
.result-icon { width:66px; height:66px; margin:-5px auto 14px; display:grid; place-items:center; color:#fff; border-radius:50%; background:var(--red); box-shadow:0 0 0 9px rgba(227,24,35,.1); font-size:32px; }
.result-data { margin:21px 0; display:grid; grid-template-columns:1fr 1fr; border-radius:12px; background:#f2e7e1; }
.result-data span { padding:12px; }
.result-data span + span { border-left:1px solid var(--line); }
.result-data small { display:block; color:var(--muted); font-size:10px; }
.result-data strong { color:var(--red); font:800 24px/1.4 ui-monospace,monospace; }
.result-website { margin:18px -12px -16px; padding:13px; display:flex; justify-content:space-between; color:var(--deep); text-decoration:none; border:1px solid rgba(227,24,35,.14); border-radius:10px; background:#fff0ed; font-size:11px; }
.result-website b { color:var(--red); }

@keyframes shake { 25%{transform:translateX(-4px)} 50%{transform:translateX(4px)} 75%{transform:translateX(-2px)} }
@keyframes slotIn { from{transform:translateY(-8px) scale(.86);opacity:.3} }
@keyframes clear { to{transform:scale(.45) rotate(8deg);opacity:0} }

@media (max-width: 900px) {
  .shell { width:min(100% - 18px,760px); padding-top:9px; }
  .hero { min-height:104px; padding:17px 19px; }
  .brand img { width:245px; }
  .title-block p { display:none; }
  .website-link { min-width:170px; }
  .topbar { flex-wrap:wrap; }
  .play-layout { grid-template-columns:1fr; }
  .board { max-width:720px; }
  .side-panel { grid-template-columns:1.2fr .8fr; }
  .tray-panel { grid-row:span 2; }
  .tray { grid-template-columns:repeat(7,1fr); min-height:0; }
  .rescue-panel { grid-column:2; }
  .power-panel { grid-column:1/-1; }
  .powers { grid-template-columns:repeat(3,1fr); }
  .restart-btn { grid-column:1/-1; }
}

@media (max-width: 620px) {
  .shell { width:100%; padding:0; }
  .hero { min-height:88px; padding:14px 12px; border-radius:0; }
  .brand { gap:11px; }
  .brand img { width:42%; max-width:190px; }
  .title-block { padding-left:11px; }
  .title-block > span { display:none; }
  .title-block h1 { font-size:clamp(18px,5.2vw,24px); white-space:nowrap; }
  .website-link { min-width:0; padding:9px 29px 9px 10px; }
  .website-link span { font-size:10px; }
  .website-link b { display:none; }
  .website-link i { right:10px; }
  .game-card { border-radius:0; }
  .topbar { padding:9px 8px; gap:4px; }
  .metric { min-width:0; flex:1; padding:2px 6px; text-align:center; }
  .metric strong { font-size:17px; }
  .mode-badge { order:2; margin:4px 0 0; flex:1; text-align:center; font-size:10px; }
  .audio-switches { order:2; flex:2; }
  .audio-switches button { flex:1; padding:7px 4px; font-size:10px; }
  .play-layout { padding:12px 7px; gap:12px; }
  .board-heading { padding:0 5px; }
  .board-heading strong { font-size:12px; }
  .board-heading p { max-width:44%; text-align:right; font-size:10px; }
  .board { aspect-ratio:1.04; border-radius:13px; }
  .card-tile { width:18.4%; border-radius:8px; }
  .side-panel { grid-template-columns:1fr; gap:8px; }
  .tray-panel { grid-row:auto; padding:11px; }
  .tray { grid-template-columns:repeat(7,1fr); }
  .rescue-panel { grid-column:auto; }
  .power-panel { grid-column:auto; padding:11px; }
  .powers { grid-template-columns:repeat(3,1fr); gap:5px; }
  .powers button { min-height:64px; padding:6px 3px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:1px; }
  .power-icon { font-size:19px; }
  .powers small { display:none; }
  .powers em { right:5px; top:5px; transform:none; }
  .restart-btn { grid-column:auto; }
  footer { padding:10px 12px; background:#640710; }
  footer span { display:none; }
  footer a { margin-left:auto; }
  .modal { padding:14px; overflow:auto; }
  .modal-card { width:calc(100vw - 28px); max-width:470px; padding:31px 22px; overflow:hidden; }
}

@media (prefers-reduced-motion: reduce) { *,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important;} }

/* Match the shared logo scale used by the other games. */
.brand img{width:min(330px,31vw)}
