* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; color: #e8e8e8; font-family: 'Press Start 2P', 'Mitr', monospace; user-select: none; -webkit-user-select: none; }
#game { position: absolute; left: 0; top: 0; image-rendering: pixelated; display: block; }

#top { position: absolute; top: 0; left: 0; right: 0; height: 30px; display: flex; align-items: center; gap: 20px; padding: 0 12px; background: linear-gradient(#14141cee, #14141caa); border-bottom: 2px solid #3a3a4a; font-size: 10px; z-index: 3; }
#top b { color: #ffd23f; font-weight: normal; }
#top .sp { flex: 1; }
#top button { margin-left: 6px; font: inherit; font-size: 9px; background: #2a2a3a; color: #eee; border: 2px solid #666; padding: 3px 8px; cursor: pointer; }

i.r { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border: 1px solid #000; vertical-align: -1px; }
i.r.rice { background: #e8c840; } i.r.water { background: #4aa8ff; } i.r.iron { background: #c0c8d4; }

#panel { position: absolute; left: 0; right: 0; bottom: 0; height: 160px; background: #191922; border-top: 4px solid #4a4a5e; display: flex; gap: 12px; padding: 6px 10px; z-index: 3; }
#mini { width: 144px; height: 144px; image-rendering: pixelated; border: 2px solid #4a4a5e; background: #000; cursor: crosshair; flex: none; }
#info { flex: 1; min-width: 0; background: #11111a; border: 2px solid #2e2e3e; padding: 8px 10px; font-size: 9px; line-height: 1.9; overflow: hidden; }
#actions { flex: none; display: grid; grid-template-columns: repeat(6, 70px); grid-auto-rows: 70px; gap: 4px; align-content: start; }

.btn { position: relative; background: #262634; border: 2px solid #5a5a70; color: #eee; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; padding: 2px; text-align: center; font-family: 'Mitr', sans-serif; font-size: 10px; line-height: 1.1; }
.btn:hover { border-color: #ffd23f; background: #30304a; }
.btn.on { border-color: #6f6; background: #243a24; }
.btn.dis, .btn.lock { opacity: 0.45; }
.btn img { height: 28px; max-width: 60px; image-rendering: pixelated; object-fit: contain; }
.btn .hk { position: absolute; top: 3px; left: 4px; color: #ffd23f; font-family: 'Press Start 2P', monospace; font-size: 8px; }
.btn .big { font-size: 20px; line-height: 28px; }
.btn .cost { font-family: 'Mitr', sans-serif; font-size: 9px; color: #ddd; white-space: nowrap; letter-spacing: -0.2px; }
.btn .cost i.r { width: 5px; height: 5px; margin: 0 1px 0 2px; }

.portrait { width: 64px; height: 64px; image-rendering: pixelated; object-fit: contain; background: #262634; border: 2px solid #444; flex: none; }
.hpb { height: 7px; background: #400; width: 170px; border: 1px solid #000; margin: 3px 0; }
.hpb > div { height: 100%; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.nm { font-family: 'Mitr', sans-serif; font-size: 17px; color: #fff; line-height: 1.2; }
.th { font-family: 'Mitr', sans-serif; font-size: 13px; line-height: 1.6; }
.dim { color: #8a8aa0; }
.multi { display: flex; flex-wrap: wrap; gap: 4px; }
.multi .u { width: 34px; background: #262634; border: 1px solid #444; }
.multi img { width: 32px; height: 32px; image-rendering: pixelated; object-fit: contain; display: block; }
.multi .hp { height: 3px; background: #4c4; }

#msgs { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); text-align: center; z-index: 4; pointer-events: none; font-family: 'Mitr', sans-serif; font-size: 17px; text-shadow: 2px 2px 0 #000; white-space: nowrap; }

[hidden] { display: none !important; }
#overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.84); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.box { background: #1b1b26; border: 4px solid #5a5a70; padding: 22px 28px; max-width: 720px; width: 100%; box-shadow: 8px 8px 0 #000; max-height: 94vh; overflow: auto; }
.box h1 { font-size: 26px; color: #ffd23f; margin: 0 0 8px; text-shadow: 3px 3px 0 #a33; }
.box h3 { font-family: 'Mitr', sans-serif; font-size: 15px; margin: 14px 0 6px; color: #ccd; font-weight: 600; }
.box ul { padding-left: 20px; margin: 10px 0; }
.box .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.box button { font-family: 'Mitr', 'Press Start 2P', sans-serif; font-size: 14px; padding: 8px 14px; background: #262634; border: 3px solid #5a5a70; color: #fff; cursor: pointer; }
.box button:hover { border-color: #ffd23f; }
.box button.on { border-color: #6f6; background: #243a24; }
.box button.lock { opacity: 0.4; cursor: not-allowed; }
.box button small { font-size: 10px; color: #aaa; }
.box button.go { font-family: 'Press Start 2P', 'Mitr', monospace; font-size: 12px; padding: 12px 18px; background: #2a3a6a; border-color: #7a9af0; margin-top: 14px; }
kbd { font-family: 'Press Start 2P', monospace; font-size: 9px; background: #333; border: 1px solid #666; padding: 1px 4px; color: #ffd23f; }

.box button.col { width: 44px; height: 44px; padding: 0; border: 3px solid #1a1a1a; box-shadow: inset -4px -4px 0 rgba(0,0,0,.3), inset 4px 4px 0 rgba(255,255,255,.25); }
.box button.col.on { border-color: #fff; outline: 2px solid #6f6; }

#seats { display: flex; flex-direction: column; gap: 6px; }
.seat { display: flex; align-items: center; gap: 10px; background: #11111a; border: 2px solid #2e2e3e; padding: 6px 10px; font-family: 'Mitr', sans-serif; font-size: 14px; flex-wrap: wrap; }
.seat.me { border-color: #6f6; }
.seat .dot { width: 18px; height: 18px; border: 2px solid #000; box-shadow: inset -3px -3px 0 rgba(0,0,0,.3), inset 3px 3px 0 rgba(255,255,255,.25); flex: none; }
.seat b { min-width: 52px; }
.seat .who { color: #8a8aa0; min-width: 40px; }
.seat .fn { color: #ffd23f; }
.seat .fbtns { display: flex; gap: 4px; flex-wrap: wrap; }
.box .seat button { font-size: 12px; padding: 3px 8px; border-width: 2px; }

.seat .tbtns { display: flex; gap: 3px; align-items: center; margin-left: auto; }
.box .seat .tbtns button { padding: 2px 8px; min-width: 26px; }
.box button:disabled { cursor: not-allowed; }
