:root{
  --brand:#6b7c3e;--brand-2:#8fa855;--accent:#c4956a;
  --bg:#f3efe7;--surface:#fffdf8;--surface-2:#f7f4ec;
  --text:#2e2e2a;--muted:#6b6b63;--border:#ddd9cf;
  --grad:linear-gradient(135deg,var(--brand),var(--accent));
  --shadow:0 1px 3px rgba(0,0,0,.08),0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:0 4px 12px rgba(0,0,0,.1);
  --radius:16px;--radius-sm:8px;
  --font-sans:'Segoe UI',system-ui,-apple-system,'Inter',Roboto,Arial,sans-serif;
  --font-mono:'SF Mono',Consolas,'Liberation Mono',Menlo,monospace;
}

*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{font-family:var(--font-sans);background:var(--bg);color:var(--text);line-height:1.6;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
img{display:block;max-width:100%}

/* ---- header ---- */
.site-head{position:sticky;top:0;z-index:100;background:rgba(243,239,231,.75);backdrop-filter:blur(12px);border-bottom:1px solid var(--border)}
.head-inner{display:flex;align-items:center;justify-content:space-between;padding:12px 0}
.brand{display:inline-flex;align-items:center;gap:10px}
.brand-mark{color:var(--brand)}
.brand-name{font-size:1.15rem;font-weight:700;letter-spacing:-.02em}
.brand-sub{color:var(--brand-2);font-weight:400;font-size:.9em}
.head-nav{display:flex;gap:24px;font-size:.9rem;font-weight:500}
.head-nav a{transition:color .2s}
.head-nav a:hover{color:var(--brand)}

/* ---- hero ---- */
.hero{padding:80px 0 60px;position:relative;overflow:hidden}
.mesh{position:absolute;inset:0;z-index:0;pointer-events:none}
.mesh::before,.mesh::after{content:'';position:absolute;border-radius:50%;filter:blur(80px);opacity:.18}
.mesh::before{width:500px;height:500px;background:var(--brand);top:-120px;right:-80px}
.mesh::after{width:400px;height:400px;background:var(--accent);bottom:-100px;left:-60px}
.hero-inner{position:relative;z-index:1;max-width:600px;text-align:center}
.eyeblink{font-family:var(--font-mono);font-size:.75rem;letter-spacing:.08em;color:var(--brand-2);margin-bottom:12px;opacity:.7}
.hero h1{font-size:clamp(2.4rem,5.5vw,3.6rem);line-height:1.1;font-weight:800;letter-spacing:-.03em;margin-bottom:16px}
.lede{font-size:1.1rem;color:var(--muted);max-width:460px;margin:0 auto 28px}
.hero-cta{margin-bottom:32px}
.hero-line{height:1px;background:var(--border);margin:0 auto;width:60%}

/* ---- buttons ---- */
.btn{display:inline-flex;align-items:center;justify-content:center;padding:10px 22px;border:none;border-radius:var(--radius-sm);background:var(--grad);color:#fff;font-weight:600;font-size:.95rem;cursor:pointer;transition:transform .15s,box-shadow .15s}
.btn:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}
.btn:active{transform:translateY(0)}
.btn-ghost{background:transparent;color:var(--text);border:1px solid var(--border)}
.btn-ghost:hover{border-color:var(--brand);color:var(--brand)}
.btn-block{width:100%;padding:12px}
.btn-sm{padding:6px 14px;font-size:.85rem}

/* ---- sections ---- */
.section{padding:72px 0}
.section-alt{background:var(--surface-2)}
.section h2{font-size:clamp(1.8rem,4vw,2.6rem);font-weight:800;letter-spacing:-.02em;margin-bottom:32px;text-align:center}

/* ---- game ---- */
.game-shell{border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;background:var(--surface)}
.game-topbar{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid var(--border);flex-wrap:wrap;gap:8px}
.res{display:flex;gap:16px;flex-wrap:wrap}
.res-item{display:inline-flex;align-items:center;gap:6px;font-size:.85rem}
.res-item em{font-style:normal;color:var(--muted);font-weight:400}
.res-item.b{font-weight:700}
.dot{width:8px;height:8px;border-radius:50%;display:inline-block}
.dot-gold{background:#d4a843}
.dot-wood{background:#6b7c3e}
.dot-crystal{background:#8e7cb8}
.dot-army{background:#c4956a}
.dot-move{background:var(--brand-2)}
.res-right{text-align:right}

.game-body{display:flex;min-height:420px}
.board-wrap{flex:1;display:flex;align-items:center;justify-content:center;padding:16px}
.side{width:240px;border-left:1px solid var(--border);padding:16px;display:flex;flex-direction:column;gap:12px;overflow-y:auto}

/* board */
.board{display:grid;gap:2px}
.cell{aspect-ratio:1;border-radius:4px;position:relative;cursor:default;display:flex;align-items:center;justify-content:center;font-size:.95rem;user-select:none;transition:background .12s,border-color .12s,box-shadow .12s}
.cell.empty{background:var(--surface-2);border:1px dashed var(--border)}
.cell.player{background:var(--brand);border-color:var(--brand-2);color:#fff;box-shadow:0 0 0 2px rgba(107,124,62,.3)}
.cell.city{background:var(--surface);border:2px solid var(--accent);color:var(--accent);font-weight:700}
.cell.enemy{background:#3a2a2a;border:2px solid #b33;color:#fff}
.cell.monster{background:#f8efe5;border:2px solid var(--accent);font-size:1.1rem}
.cell.monster.weak{border-color:#8a8;color:#684}
.cell.monster.strong{border-color:#b33}
.cell.gold{background:#fef8e8;border:2px solid #d4a843}
.cell.tree{background:#f0f5e8;border:2px solid #8fa855}
.cell.crystal{background:#f5f0ff;border:2px solid #8e7cb8}
.cell.mountain{background:#ece8e0;border:1px solid #ccc}
.cell.water{background:var(--surface);border:1px solid #dce8f0;color:#8ab4d0}
.cell.road{background:var(--surface);border:1px solid var(--border)}
.cell.path{background:rgba(107,124,62,.12);border:1px solid var(--brand-2);box-shadow:inset 0 0 0 1px rgba(107,124,62,.2)}
.cell.path:hover{background:rgba(107,124,62,.22)}
.cell.visited{background:var(--surface-2);border:1px solid var(--border)}

/* panels */
.panel{border:1px solid var(--border);border-radius:var(--radius-sm);padding:12px;background:var(--surface)}
.panel h3{font-family:var(--font-mono);font-size:.75rem;letter-spacing:.06em;color:var(--muted);margin-bottom:8px}
.log{list-style:none;max-height:180px;overflow-y:auto;font-size:.82rem;line-height:1.5}
.log li{padding:3px 0;border-bottom:1px dotted var(--border)}
.log li:last-child{border-bottom:none}
.recruit{background:var(--surface-2)}
.unit{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px dotted var(--border)}
.unit:last-child{border-bottom:none}
.unit-info{display:flex;flex-direction:column;gap:1px}
.unit-info span{font-size:.75rem;color:var(--muted)}

/* cards */
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);padding:24px;transition:transform .15s,box-shadow .15s}
.card:hover{transform:translateY(-3px);box-shadow:var(--shadow-lg)}
.card .num{font-family:var(--font-mono);font-size:1.6rem;color:var(--brand);margin-bottom:8px;display:block}
.card h3{font-size:1.1rem;font-weight:700;margin-bottom:6px}

/* table */
.board-table{overflow-x:auto}
.board-table table{width:100%;border-collapse:collapse}
.board-table th,.board-table td{padding:10px 14px;text-align:left;border-bottom:1px solid var(--border);font-size:.9rem}
.board-table th{background:var(--surface-2);font-weight:600;font-size:.8rem;text-transform:uppercase;letter-spacing:.04em}
.board-table tr.lead{background:rgba(107,124,62,.06)}
.mono{font-family:var(--font-mono)}
.small{font-size:.8rem}

/* overlay */
.overlay{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;background:rgba(30,30,25,.6);backdrop-filter:blur(4px);opacity:0;pointer-events:none;transition:opacity .25s}
.overlay.show{opacity:1;pointer-events:auto}
.overlay-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:32px;max-width:420px;width:90%;text-align:center}
.overlay-card h2{font-size:1.8rem;margin-bottom:8px}
.score-form{display:flex;flex-direction:column;gap:12px;margin-top:20px}
.score-form input[type=text]{padding:10px 14px;border:1px solid var(--border);border-radius:var(--radius-sm);font-size:1rem;font-family:var(--font-sans)}
.score-form input[type=text]:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(107,124,62,.15)}

/* footer */
.site-foot{padding:32px 0;border-top:1px solid var(--border);margin-top:40px}
.foot-inner{display:flex;justify-content:space-between;align-items:center;font-size:.85rem}

@media(max-width:768px){
  .head-nav{display:none}
  .hero{padding:48px 0 36px}
  .hero h1{font-size:2rem}
  .game-body{flex-direction:column}
  .side{width:100%;border-left:none;border-top:1px solid var(--border)}
  .game-topbar{flex-direction:column;align-items:stretch;text-align:center}
  .res-right{text-align:center}
  .cards{grid-template-columns:1fr}
  .foot-inner{flex-direction:column;gap:4px;text-align:center}
}

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