@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

/* ============================================================
   VARIABLES
   ============================================================ */

:root {
	--cursor: url('cursor.png'), auto;
	--paper: #fffefb;
	--ink: #2c2416;
	--ink2: #4a3f2f;
	--ink3: #6b5c45;
	--line: #c8bfa8;
	--red-ink: #c0392b;
	--blue-ink: #1a4f8a;
	--purple-ink: #5b2d8e;
	--green-ink: #1a6b3c;
	--yellow-hl: #f4e04d;
	--orange-hl: #f4a84d;
	--pink-hl: #f48db0;
	--pencil: #888070;
	--pencil2: #ffb605;
	--shadow: rgba(44, 36, 22, 0.18);
	--shadow2: rgba(0, 0, 0, 0.1);
}

/* ============================================================
   BASE
   ============================================================ */

body { width: 100%; min-height: 100vh; margin: 0; overflow-x: hidden; cursor: crosshair; font-family: 'Montserrat'; }

body::before {
	content: '';
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	background:
		repeating-linear-gradient(to bottom, transparent 0, transparent 27px, var(--red-ink) 28px, transparent 29px),
		linear-gradient(to right, transparent 54px, var(--paper) 55px, transparent 56px),
		var(--paper);
}

/* ============================================================
   SCREENS
   ============================================================ */

.screen { display: none; }
.screen.active { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: flex; }

/* ============================================================
   MENU
   ============================================================ */

.menu { width: 40%; background-color: var(--pencil2); border-right: 8px solid var(--ink3); gap: 30px; z-index: 100; display: flex; align-items: center; justify-content: center; }
.menu-content { display: flex; flex-direction: column; justify-content: center; width: 100%; }
.menu h1 { font-size: 5em; font-weight: 900; color: white; text-shadow: 3px 3px 0 var(--orange-hl), 6px 6px 10px var(--yellow-hl); transform: rotate(-5deg); margin-left: -2rem; }
.menu span { display: inline-block; animation: float 3s ease-in-out infinite; }

@keyframes float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-10px); }
}

.menu-btn { width: 75%; padding: 0.5em 2em; font-size: 1.5em; font-weight: 800; color: var(--ink2); border: none; border-radius: 40px; box-shadow: 6px 6px 0 var(--orange-hl); transform: rotate(-5deg); transition: 0.2s ease; margin-left: 2.25em; margin-bottom: 1.5em; }
.menu-btn:nth-child(2) { background: #fff176; }
.menu-btn:nth-child(3) { background: #81d4fa; }
.menu-btn:nth-child(4) { background: #aed581; }
.menu-btn:hover { cursor: var(--cursor); transform: scale(1.1) rotate(0deg); background: white; }

.menu-side { width: 60%; display: flex; justify-content: center; align-items: flex-start; position: relative; height: 100vh; overflow-y: auto; padding: 40px 0; scrollbar-width: none; }

#menuOptions,
#menuRules,
#menuDucks { display: none; flex-direction: column; align-items: center; justify-content: center; width: 100%; }

#menuOptions { gap: 20px; }
#menuRules { padding: 40px; gap: 0; }

/* ============================================================
   SETUP OPTIONS
   ============================================================ */

.setup-section { width: 100%; max-width: 550px; background: var(--paper); border: 3px solid var(--ink); border-radius: 15px; padding: 20px; box-shadow: 6px 6px 0 var(--shadow2); position: relative; transform: rotate(-0.5deg); flex-shrink: 0; }
.setup-section:nth-child(even) { transform: rotate(0.8deg); }
.setup-section h3 { font-family: 'Montserrat', sans-serif; font-weight: 900; font-size: 1.2rem; color: var(--ink); margin-bottom: 15px; border-bottom: 2px dashed var(--line); padding-bottom: 8px; text-transform: uppercase; }

.option-row { display: flex; gap: 12px; flex-wrap: wrap; }

.opt-card { flex: 1; min-width: 120px; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 12px; cursor: var(--cursor); transition: all 0.2s ease; text-align: center; }
.opt-card:hover { transform: scale(1.05); border-color: var(--ink); }
.opt-card.selected { border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--shadow); }
.opt-card.disabled { opacity: 0.3; filter: grayscale(1); cursor: not-allowed; pointer-events: none; transform: none !important; box-shadow: none !important; }
.opt-card h4 { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.opt-card p { font-size: 0.85rem; font-weight: 600; margin: 0; line-height: 1.2; opacity: 0.8; }

#player-count-opts .opt-card.selected { background: #81d4fa; color: #01579b; }
#ai-opts .opt-card.selected { background: #ffab91; color: #b71c1c; }
#mode-opts .opt-card.selected { background: var(--yellow-hl); color: var(--ink); }

.opt-badge { display: inline-block; background: var(--red-ink); color: #fff; border-radius: 5px; padding: 2px 6px; font-size: 10px; font-weight: 900; margin-bottom: 4px; text-transform: uppercase; }

.start-btn { width: 100%; max-width: 550px; padding: 16px; font-family: 'Montserrat', sans-serif; font-size: 1.2rem; font-weight: 900; color: var(--ink); background: var(--yellow-hl); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 6px 6px 0 var(--shadow); cursor: var(--cursor); transition: 0.2s ease; text-transform: uppercase; letter-spacing: 1px; transform: rotate(-0.5deg); flex-shrink: 0; margin-bottom: 10px; }
.start-btn:hover { transform: scale(1.03) rotate(0deg); background: var(--orange-hl); box-shadow: 8px 8px 0 var(--shadow); }

/* ============================================================
   LOBBY / ONLINE
   ============================================================ */

.lobby-btn { font-family: 'Montserrat', sans-serif; font-weight: 800; border: 2px solid var(--ink); border-radius: 8px; padding: 10px; transition: 0.2s; box-shadow: 3px 3px 0 var(--shadow2); }
.lobby-btn-create { background: #aed581; color: #33691e; }
.lobby-btn-join { background: #fff176; color: #f57f17; }
.lobby-btn:hover { transform: translateY(-2px); box-shadow: 5px 5px 0 var(--shadow2); filter: brightness(1.05); }

.lobby-input { border: 2px solid var(--ink); border-radius: 8px; padding: 8px; font-weight: 900; text-align: center; width: 100%; margin-bottom: 10px; }

.room-code-display { background: var(--ink); color: var(--yellow-hl); font-weight: 900; font-size: 1.5rem; padding: 10px; text-align: center; border-radius: 8px; letter-spacing: 4px; margin-bottom: 10px; }

.lobby-players-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.lobby-player-row { background: var(--paper); border: 2px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; font-weight: 700; color: var(--ink2); }

.lobby-status { font-size: 0.85rem; font-weight: 800; color: var(--green-ink); min-height: 20px; text-align: center; }

.online-notice { font-size: 10px; color: var(--ink3); margin-top: 10px; font-style: italic; line-height: 1.2; }

/* ============================================================
   ANIMATIONS
   ============================================================ */

.slide-out-left { animation: slideOutLeft 0.8s forwards cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes slideOutLeft {
	0% { transform: translateX(0); opacity: 1; }
	100% { transform: translateX(-100%); opacity: 0; display: none; }
}

@keyframes cardShake {
	0% { transform: rotate(-2deg) translateY(-1px); }
	100% { transform: rotate(2deg) translateY(1px); }
}

@keyframes activeGlow {
	from { border-color: var(--pencil2); transform: translateY(0); }
	to { border-color: var(--orange-hl); transform: translateY(-3px); }
}

@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.4; }
}

/* ============================================================
   RULES SCREEN
   ============================================================ */

.rules-pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 0 0; font-weight: 900; font-size: 0.85rem; }
.rules-page-btn { background: var(--ink); color: var(--yellow-hl); border: none; border-radius: 6px; padding: 4px 14px; font-weight: 900; cursor: pointer; transition: 0.15s; }
.rules-page-btn:hover { background: var(--red-ink); }
.rules-page-btn.active { background: var(--pencil2); color: var(--ink); }
.rules-page { display: none; width: 100%; }
.rules-page.active { display: block; }

.soo-explain-grid { display: flex; flex-direction: column; gap: 20px; width: 100%; align-items: center; }

.ability-guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 20px 20px; }
.ability-guide-card { background: white; border: 3px solid var(--ink); border-radius: 12px; padding: 12px; box-shadow: 4px 4px 0 var(--shadow2); position: relative; }
.ability-guide-card .ab-emoji { font-size: 1.6rem; display: block; margin-bottom: 4px; }
.ability-guide-card .ab-name { font-weight: 900; font-size: 0.95rem; color: var(--ink); margin-bottom: 4px; }
.ability-guide-card .ab-effect { font-size: 0.78rem; font-weight: 700; color: var(--ink3); line-height: 1.4; margin-bottom: 6px; }
.ability-guide-card .ab-tip { font-size: 0.7rem; font-weight: 600; font-style: italic; color: var(--purple-ink); border-top: 1px dashed var(--line); padding-top: 5px; margin-top: 4px; }
.ab-badge { position: absolute; top: -8px; right: 8px; background: var(--pencil2); color: var(--ink); font-size: 0.6rem; font-weight: 900; padding: 2px 8px; border-radius: 8px; border: 1.5px solid var(--ink); text-transform: uppercase; }

/* ============================================================
   DUCK CARDS (Rules)
   ============================================================ */

.squad-container { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; padding: 50px 30px 30px; position: relative; width: 100%; max-width: 600px; }

.duck-card { padding: 25px 15px; border: 3px solid #333; border-radius: 15px; text-align: center; position: relative; box-shadow: 5px 5px 0 var(--shadow2); transition: 0.2s; }
.duck-card:hover { transform: scale(1.1) rotate(0deg); cursor: var(--cursor); }
.duck-card h3 { font-weight: 900; margin: 0; font-size: 1.5rem; }
.duck-card p { font-weight: 700; margin: 5px 0 0; font-size: 1.1rem; font-style: italic; }

.a-card { transform: rotate(-3deg); background: #81d4fa; border-color: #0277bd; color: #01579b; }
.e-card { transform: rotate(2deg); background: #ff8a80; border-color: #c62828; color: #b71c1c; }
.i-card { transform: rotate(1deg); background: #b3e5fc; border-color: #0277bd; color: #01579b; }
.o-card { transform: rotate(-2deg); background: #ffab91; border-color: #c62828; color: #b71c1c; }

.sticker { position: absolute; top: -10px; left: -10px; background: white; border: 2px solid; width: 30px; height: 30px; border-radius: 50%; font-weight: 900; font-size: 1.25rem; display: flex; align-items: center; justify-content: center; }

.badge { font-size: 0.8rem; text-transform: uppercase; background: white; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--ink); display: inline-block; margin-top: 8px; }
.a-card .badge, .i-card .badge { color: #01579b; border-color: #01579b; }
.e-card .badge, .o-card .badge { color: #c62828; border-color: #c62828; }

.battle-tape { margin-top: 20px; background: #fff; border: 2px solid #333; padding: 15px; position: relative; box-shadow: 8px 8px 0 var(--shadow2); transform: rotate(1deg); }
#cheatTape { margin-top: -10px; }

.cheat-sheet { list-style: none; padding: 0; margin-top: 15px; }
.cheat-sheet li { font-size: 0.8rem; margin-bottom: 8px; padding: 0 0 5px 5px; border-bottom: 1px dashed #ccc; }
.cheat-sheet b { margin-left: 0.5rem; }

.tape-piece { position: absolute; top: -10px; left: 50%; transform: translateX(-50%) rotate(-1deg); background: rgba(244, 224, 77, 0.65); padding: 4px 25px; font-weight: 900; font-size: 1.5rem; color: var(--ink2); box-shadow: 2px 2px 5px rgba(0,0,0,0.05); z-index: 10; white-space: nowrap; border-left: 1px solid rgba(0,0,0,0.1); border-right: 1px solid rgba(0,0,0,0.1); }

.emoji { font-size: 1.2rem; background: white; padding: 5px; border-radius: 8px; box-shadow: 2px 2px 0 var(--shadow); }

/* ============================================================
   DUCK HEROES (Ducks tab)
   ============================================================ */

#menuDucks .squad-container { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; padding: 60px 20px 40px; max-height: 85vh; overflow-y: auto; scrollbar-width: none; }
#menuOptions .squad-container::-webkit-scrollbar,
#menuRules .squad-container::-webkit-scrollbar,
#menuDucks .squad-container::-webkit-scrollbar { display: none; }

.hero-card { border: 3px solid #2c2416; padding: 15px; border-radius: 12px; box-shadow: 6px 6px 0 var(--shadow2); transition: 0.2s; background: white; color: #2c2416 !important; }
.hero-card:hover { transform: scale(1.05) rotate(0deg); cursor: var(--cursor); }
.hero-card h3 { font-size: 1.3rem; font-weight: 900; margin: 5px 0; }
.hero-card .sticker { width: 40px; height: 40px; color: var(--ink); font-size: 1rem; }

.hero-name { font-weight: 900; font-size: 1.2rem; margin: 5px 0; color: #222; }

.mc-card { transform: rotate(-2deg); background: #fff9c4; }
.waterfowl-card { transform: rotate(1deg); background: #e1f5fe; }
.mibibe-card { transform: rotate(-1deg); background: #f1f8e9; }
.night-card { transform: rotate(2deg); background: #e8eaf6; }
.thunder-card { transform: rotate(-2deg); background: #f3e5f5; }
.spider-card { transform: rotate(1deg); background: #ffebee; }
.prof-card { transform: rotate(-1deg); background: #eceff1; }
.dyna-card { transform: rotate(2deg); background: #fff3e0; }

.img-frame { margin: 5px 0 10px; background: #eee; border: 3px solid #333; border-radius: 8px; overflow: hidden; height: 140px; }
.img-frame img { width: 100%; height: 100%; object-fit: cover; }

.stats { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; font-weight: 700; color: #444; }
.active-skill { color: var(--purple-ink) !important; font-style: italic; border-top: 1px dashed rgba(0,0,0,0.2); margin-top: 5px; padding-top: 5px; }

/* ============================================================
   SOO (Square of Opposition — Rules tab)
   ============================================================ */

.soo-wrap { background: rgba(255, 255, 255, 0.75); border: 3px solid var(--ink); border-radius: 12px; padding: 15px; box-shadow: 4px 4px 0 var(--shadow2); font-family: 'Montserrat', sans-serif; }
.soo-title { font-weight: 900; font-size: 0.85rem; color: var(--ink); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px dashed var(--line); }
.soo-2x2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.soo-n { border: 2px solid; border-radius: 8px; padding: 8px; text-align: center; }
.soo-n h5 { font-weight: 900; font-size: 0.75rem; margin: 0 0 2px; }
.soo-n p { font-size: 0.7rem; font-weight: 600; margin: 0; color: var(--ink2); font-style: italic; }
.soo-rels { background: #fff; border: 2px solid var(--ink); padding: 10px; border-radius: 8px; font-size: 0.75rem; line-height: 1.6; box-shadow: 4px 4px 0 var(--shadow2); font-weight: 700; color: var(--ink2); }
.soo-rels b { display: block; margin-top: 4px; }

.soo-duck-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.soo-duck-card { border: 3px solid; border-radius: 12px; padding: 10px 8px; position: relative; text-align: center; box-shadow: 3px 3px 0 var(--shadow2); transition: transform 0.2s; }
.soo-a { background: #81d4fa; border-color: #0277bd; color: #01579b !important; transform: rotate(-2deg); }
.soo-e { background: #ff8a80; border-color: #c62828; color: #b71c1c !important; transform: rotate(1deg); }
.soo-i { background: #b3e5fc; border-color: #0277bd; color: #01579b !important; transform: rotate(1deg); }
.soo-o { background: #ffab91; border-color: #c62828; color: #b71c1c !important; transform: rotate(-2deg); }
.soo-sticker { position: absolute; top: -8px; left: -8px; background: white; border: 2px solid var(--ink); width: 24px; height: 24px; border-radius: 50%; font-weight: 900; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; color: var(--ink); z-index: 2; }
.soo-duck-name { font-weight: 900; font-size: 0.85rem; margin-bottom: 2px; display: block; }
.soo-duck-quote { font-size: 0.65rem; font-style: italic; font-weight: 700; line-height: 1.2; margin-bottom: 5px; opacity: 0.9; }
.soo-duck-badge { display: inline-block; background: white; border: 1px solid currentColor; border-radius: 8px; padding: 1px 6px; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; }
.soo-duck-tmpl { font-size: 0.6rem; color: var(--ink3); margin-top: 5px; font-weight: 600; border-top: 1px dashed rgba(0,0,0,0.1); padding-top: 3px; }

/* ============================================================
   ROLL SCREEN
   ============================================================ */

#screen-roll { flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: var(--paper); padding: 40px; overflow-y: auto; }
#screen-roll h1 { font-weight: 900; font-size: 2.5rem; color: var(--ink); text-shadow: 3px 3px 0 var(--yellow-hl); transform: rotate(-2deg); text-align: center; }
#screen-roll p { font-weight: 700; font-size: 1.1rem; color: var(--ink3); text-align: center; margin: 0; }

.roll-cards-grid { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

.player-label { font-weight: 900; font-size: 1rem; margin-bottom: 6px; text-align: center; letter-spacing: 1px; }

.roll-card { width: 200px; background: white; border: 3px solid var(--ink); border-radius: 14px; padding: 18px; box-shadow: 6px 6px 0 var(--shadow2); transition: 0.15s ease; min-height: 160px; }
.roll-card.rolling { animation: cardShake 0.15s infinite alternate; opacity: 0.85; border-color: var(--pencil); background: #f5f5f0; }
.roll-card.settled { animation: none; border-color: var(--ink); box-shadow: 8px 8px 0 var(--shadow); background: #fffefb; transform: rotate(-1deg); }

.rc-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rc-name { font-size: 1rem; font-weight: 900; }
.rc-role { font-size: 0.75rem; font-weight: 700; color: var(--ink3); text-transform: uppercase; letter-spacing: 0.5px; }
.rc-passive, .rc-active { font-size: 0.8rem; font-weight: 600; color: var(--ink2); line-height: 1.4; }
.rc-active { color: var(--purple-ink); font-style: italic; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 6px; }

/* ============================================================
   GAME SCREEN LAYOUT
   ============================================================ */

#screen-game { flex-direction: column; background: transparent; overflow: hidden; }

.game-topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: var(--ink); color: var(--yellow-hl); border-bottom: 3px solid var(--pencil2); flex-shrink: 0; z-index: 10; }
.game-title { font-weight: 900; font-size: 1.3rem; letter-spacing: 2px; text-shadow: 2px 2px 0 var(--orange-hl); }

.legend-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.leg-chip { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; font-weight: 700; color: var(--paper); }
.leg-sq { width: 14px; height: 14px; border-radius: 3px; border: 2px solid; flex-shrink: 0; }

.game-body { display: flex; flex: 1; overflow: hidden; gap: 15px; padding: 10px; }

.game-left,
.game-right { width: 260px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px; overflow-y: auto; scrollbar-width: none; background: rgba(255, 254, 251, 0.4); border-right: 2px dashed var(--line); }
.game-right { border-right: none; border-left: 2px dashed var(--line); }
.game-left::-webkit-scrollbar,
.game-right::-webkit-scrollbar { display: none; }

.game-center { flex: 1; display: flex; flex-direction: column; align-items: center; overflow: hidden; padding: 10px; gap: 10px; }

/* ============================================================
   PLAYER CARDS
   ============================================================ */

.player-card { background: rgba(255, 255, 255, 0.75); border: 3px solid var(--ink); border-radius: 12px; padding: 12px; box-shadow: 4px 4px 0 var(--shadow2); font-family: 'Montserrat', sans-serif; position: relative; }
.player-card.active-player { box-shadow: 0 0 0 3px var(--pencil2), 4px 4px 0 var(--shadow); animation: activeGlow 1.5s ease-in-out infinite alternate; }
.eliminated-card { opacity: 0.4; }

.pcard-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.pcard-emoji { font-size: 20px; }
.pcard-name { font-weight: 900; font-size: 1rem; margin-bottom: 4px; }
.pcard-char { font-size: 0.75rem; font-weight: 700; color: var(--ink3); margin-bottom: 8px; }
.pcard-sub { font-size: 11px; color: var(--ink3); }
.pcard-stat { font-size: 10px; color: var(--ink3); margin-bottom: 3px; }
.pcard-status { font-size: 0.7rem; font-weight: 700; color: var(--purple-ink); margin-top: 4px; font-style: italic; min-height: 14px; }

.pcard-hp-row { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.pcard-hp-bg { flex: 1; height: 8px; background: var(--line); border-radius: 2px; overflow: hidden; border: 1px solid var(--ink3); }
.pcard-hp-fill { height: 100%; border-radius: 2px; transition: width 0.4s; }
.pcard-hp-bar-wrap { background: var(--line); border-radius: 999px; height: 10px; overflow: hidden; border: 1.5px solid var(--ink); margin-bottom: 4px; }
.pcard-hp-bar { height: 100%; background: #66bb6a; border-radius: 999px; transition: width 0.4s ease; }
.pcard-hp-bar.low { background: #ffa726; }
.pcard-hp-bar.critical { background: var(--red-ink); }
.pcard-hp-val { font-size: 12px; font-weight: 700; min-width: 40px; text-align: right; font-family: 'Caveat', cursive; }
.pcard-hp-text { font-size: 0.75rem; font-weight: 800; color: var(--ink2); text-align: right; }

.pcard-passive { font-size: 10px; color: #5b2d8e; background: rgba(91, 45, 142, 0.08); border: 1px solid rgba(91, 45, 142, 0.2); border-radius: 3px; padding: 2px 5px; margin-top: 3px; line-height: 1.3; }
.pcard-active { font-size: 10px; color: #c0580a; background: rgba(192, 88, 10, 0.08); border: 1px solid rgba(192, 88, 10, 0.2); border-radius: 3px; padding: 2px 5px; margin-top: 2px; line-height: 1.3; }
.pcard-active.used { background: #e0e0e0 !important; border-color: #999 !important; color: #777 !important; text-decoration: line-through; opacity: 0.7; }
.pcard-active:not(.used):hover { filter: brightness(1.1); transform: scale(1.02); }
.pcard-active-btn { cursor: pointer; }

/* ============================================================
   TURN BAR
   ============================================================ */

.turn-bar { display: flex; align-items: center; justify-content: space-between; width: 100%; background: rgba(255, 255, 255, 0.75); border: 3px solid var(--ink); border-radius: 12px; padding: 10px 16px; box-shadow: 4px 4px 0 var(--shadow2); flex-shrink: 0; }
.turn-bar-actions { display: flex; gap: 6px; align-items: center; }
.turn-name { font-weight: 900; font-size: 1.1rem; color: var(--ink); }
.turn-info { font-size: 0.8rem; font-weight: 700; color: var(--ink3); margin-top: 2px; }
.dice-result-display { font-weight: 900; font-size: 1.4rem; color: var(--red-ink); min-width: 60px; text-align: right; }

/* ============================================================
   BOARD & TILES
   ============================================================ */

.board-wrap { flex: 1 !important; display: flex !important; align-items: center !important; justify-content: center !important; overflow: auto !important; width: 100% !important; min-height: 0 !important; }

#board-container { display: grid !important; grid-template-columns: repeat(11, 1fr) !important; grid-template-rows: repeat(11, 1fr) !important; width: min(560px, calc(100vh - 220px)) !important; height: min(560px, calc(100vh - 220px)) !important; margin: auto !important; flex-shrink: 0; position: relative !important; background: var(--paper) !important; border: 4px solid var(--ink) !important; box-shadow: 8px 8px 0 var(--shadow) !important; }

#board-center { grid-column: 2 / 11 !important; grid-row: 2 / 11 !important; display: grid !important; grid-template-columns: 1fr 1fr !important; grid-template-rows: 1fr 1fr !important; background: rgba(255, 255, 255, 0.5) !important; z-index: 1 !important; position: relative !important; }

.tile { position: relative !important; box-sizing: border-box !important; overflow: hidden !important; display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; z-index: 5 !important; border: 1px solid var(--line) !important; }
.tile::before { content: '' !important; position: absolute !important; z-index: 6 !important; pointer-events: none !important; }

.combat { background-color: #ffe8e8 !important; }
.logic { background-color: #deeaf7 !important; }
.ability { background-color: #ecdff7 !important; }
.choice { background-color: #fffacd !important; }
.corner { background-color: #f0e6d0 !important; }
.center { background: none !important; border: none !important; z-index: 1 !important; }
.center::before { display: none !important; }
.choice::before, .corner::before { display: none !important; }

.bottom-tile.combat::before { top: 0; left: 0; right: 0; height: 22%; background: #c0392b; }
.bottom-tile.logic::before { top: 0; left: 0; right: 0; height: 22%; background: #1a4f8a; }
.bottom-tile.ability::before { top: 0; left: 0; right: 0; height: 22%; background: #5b2d8e; }
.top-tile.combat::before { bottom: 0; left: 0; right: 0; height: 22%; background: #c0392b; }
.top-tile.logic::before { bottom: 0; left: 0; right: 0; height: 22%; background: #1a4f8a; }
.top-tile.ability::before { bottom: 0; left: 0; right: 0; height: 22%; background: #5b2d8e; }
.left-tile.combat::before { top: 0; right: 0; bottom: 0; width: 22%; background: #c0392b; }
.left-tile.logic::before { top: 0; right: 0; bottom: 0; width: 22%; background: #1a4f8a; }
.left-tile.ability::before { top: 0; right: 0; bottom: 0; width: 22%; background: #5b2d8e; }
.right-tile.combat::before { top: 0; left: 0; bottom: 0; width: 22%; background: #c0392b; }
.right-tile.logic::before { top: 0; left: 0; bottom: 0; width: 22%; background: #1a4f8a; }
.right-tile.ability::before { top: 0; left: 0; bottom: 0; width: 22%; background: #5b2d8e; }

.tile-number { position: absolute; font-size: 0.5rem; font-weight: 900; font-family: 'Montserrat', sans-serif; color: white; z-index: 8; display: flex; align-items: center; justify-content: center; line-height: 1; }
.bottom-tile .tile-number { top: 0; left: 0; width: 100%; height: 22%; }
.top-tile .tile-number { bottom: 0; left: 0; width: 100%; height: 22%; }
.left-tile .tile-number { top: 0; right: 0; width: 22%; height: 100%; writing-mode: vertical-rl; }
.right-tile .tile-number { top: 0; left: 0; width: 22%; height: 100%; writing-mode: vertical-rl; transform: rotate(180deg); }
.corner .tile-number, .choice .tile-number { display: none; }

.tile-name { position: absolute; font-size: 0.42rem; font-weight: 800; font-family: 'Montserrat', sans-serif; text-align: center; word-break: break-word; line-height: 1.15; z-index: 7; pointer-events: none; padding: 2px; }
.bottom-tile .tile-name { bottom: 0; left: 0; width: 100%; height: 78%; display: flex; align-items: center; justify-content: center; }
.top-tile .tile-name { top: 0; left: 0; width: 100%; height: 78%; display: flex; align-items: center; justify-content: center; }
.left-tile .tile-name { top: 0; left: 0; width: 78%; height: 100%; display: flex; align-items: center; justify-content: center; writing-mode: vertical-rl; transform: rotate(180deg); }
.right-tile .tile-name { top: 0; right: 0; width: 78%; height: 100%; display: flex; align-items: center; justify-content: center; writing-mode: vertical-rl; }
.combat .tile-name { color: #c0392b; }
.logic .tile-name { color: #1a4f8a; }
.ability .tile-name { color: #5b2d8e; }
.choice .tile-name { color: #b8860b; font-size: 0.55rem; }
.corner .tile-name { color: #2c2416; font-size: 0.65rem; inset: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }

.player-container { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 1px; z-index: 20; pointer-events: none; }

.token { position: absolute; width: 24px; height: 24px; border-radius: 50%; border: 2px solid white; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; z-index: 30; box-shadow: 2px 2px 4px rgba(0,0,0,0.35); pointer-events: none; will-change: left, top; transition: left 0.2s ease-out, top 0.2s ease-out !important; }

/* ============================================================
   BOARD CENTER LOGO
   ============================================================ */

.center-logo-area { grid-column: 1 / 3; grid-row: 1 / 3; display: flex; align-items: center; justify-content: center; position: absolute; inset: 0; pointer-events: none !important; }
.center-logo-text { font-family: 'Montserrat', sans-serif; font-weight: 900; font-size: 1.8rem; color: var(--line); text-align: center; letter-spacing: 3px; line-height: 1.2; transform: rotate(-10deg); }

.center-dice-overlay { grid-column: 1 / 3; grid-row: 1 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10; gap: 15px; padding-top: 40px; }

/* ============================================================
   DICE
   ============================================================ */

.dice-section { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; padding-bottom: 6px; }
.dice-row, .roll-btn { pointer-events: auto !important; }
.dice-row { display: flex; gap: 20px; align-items: center; }

.container-dice { width: 64px; height: 64px; perspective: 800px; display: flex; align-items: center; justify-content: center; }

.dice { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1); transform: rotateX(-25deg) rotateY(35deg); }
.dice.rolling { animation: diceSpin 0.9s ease-in-out; }

.dice .side {
	position: absolute;
	width: 64px;
	height: 64px;
	background: white;
	border: 2px solid var(--ink);
	border-radius: 10px;
	display: grid;
	grid-template-areas: "tl . tr" "ml dc mr" "bl . br";
	grid-template-columns: 1fr 1fr 1fr;
	grid-template-rows: 1fr 1fr 1fr;
	padding: 6px;
	box-sizing: border-box;
	backface-visibility: hidden;
	box-shadow: inset 0 0 6px rgba(0,0,0,0.08), 2px 2px 6px rgba(0,0,0,0.12);
}

.dice .side:nth-child(1) { transform: rotateY(0deg) translateZ(32px); }
.dice .side:nth-child(2) { transform: rotateY(180deg) translateZ(32px); }
.dice .side:nth-child(3) { transform: rotateY(90deg) translateZ(32px); }
.dice .side:nth-child(4) { transform: rotateY(-90deg) translateZ(32px); }
.dice .side:nth-child(5) { transform: rotateX(90deg) translateZ(32px); }
.dice .side:nth-child(6) { transform: rotateX(-90deg) translateZ(32px); }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); align-self: center; justify-self: center; }
.dot.tl { grid-area: tl; }
.dot.tr { grid-area: tr; }
.dot.ml { grid-area: ml; }
.dot.dc { grid-area: dc; }
.dot.mr { grid-area: mr; }
.dot.bl { grid-area: bl; }
.dot.br { grid-area: br; }

@keyframes diceSpin {
	0% { transform: rotateX(0deg) rotateY(0deg); }
	25% { transform: rotateX(180deg) rotateY(90deg); }
	50% { transform: rotateX(360deg) rotateY(180deg); }
	75% { transform: rotateX(540deg) rotateY(270deg); }
	100% { transform: rotateX(720deg) rotateY(360deg); }
}

.roll-btn { font-family: 'Montserrat', sans-serif; font-weight: 900; font-size: 1rem; background: var(--pencil2); color: var(--ink); border: 3px solid var(--ink); border-radius: 10px; padding: 10px 28px; box-shadow: 5px 5px 0 var(--shadow); cursor: var(--cursor); transition: 0.2s; text-transform: uppercase; letter-spacing: 1px; z-index: 676767 !important; }
.roll-btn:hover { transform: scale(1.05); background: var(--orange-hl); box-shadow: 7px 7px 0 var(--shadow); }
.roll-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.ai-thinking { font-size: 0.8rem; font-weight: 700; color: var(--ink3); font-style: italic; display: none; animation: pulse 1s ease-in-out infinite; }

/* ============================================================
   BATTLE LOG PANEL
   ============================================================ */

.panel { background: rgba(255, 255, 255, 0.75); border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; box-shadow: 4px 4px 0 var(--shadow2); flex: 1; display: flex; flex-direction: column; min-height: 0; }
.panel-title { background: var(--ink); color: var(--yellow-hl); font-weight: 900; font-size: 0.85rem; padding: 8px 12px; letter-spacing: 1px; text-transform: uppercase; flex-shrink: 0; }

.log-wrap { padding: 10px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line) transparent; display: flex; flex-direction: column; gap: 5px; }

.log-entry { font-size: 0.75rem; font-weight: 600; color: var(--ink2); padding: 5px 8px; border-left: 3px solid var(--line); border-radius: 0 6px 6px 0; background: var(--paper); line-height: 1.4; }
.log-entry.log-combat { border-left-color: var(--red-ink); background: #fff5f5; }
.log-entry.log-logic { border-left-color: var(--blue-ink); background: #f0f5ff; }
.log-entry.log-win { border-left-color: var(--green-ink); background: #f0fff4; }
.log-entry.log-lose { border-left-color: var(--pencil); background: #f9f9f9; }
.log-entry.log-system { border-left-color: var(--pencil2); background: #fffdf0; font-style: italic; }

/* ============================================================
   DECK STACKS
   ============================================================ */

.deck-stack { background: white; border: 3px solid var(--ink); border-radius: 10px; padding: 12px 8px; text-align: center; font-family: 'Montserrat', sans-serif; font-weight: 900; font-size: 0.7rem; line-height: 1.4; cursor: var(--cursor); box-shadow: 4px 4px 0 var(--shadow2); transition: 0.2s; max-width: 100px; }
.deck-stack:hover { transform: scale(1.05) rotate(-2deg); box-shadow: 6px 6px 0 var(--shadow); }
.prop-stack { background: #deeaf7; color: var(--blue-ink); transform: rotate(-5deg); }
.ques-stack { background: #ffe8e8; color: var(--red-ink); transform: rotate(4deg); }
.deck-label { font-size: 0.6rem; font-weight: 700; color: var(--ink3); margin-top: 6px; font-style: italic; }

/* ============================================================
   INVENTORY BUTTON
   ============================================================ */

.inv-btn { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 0.85rem; background: #e8eaf6; color: var(--purple-ink); border: 2px solid var(--purple-ink); border-radius: 8px; padding: 6px 16px; cursor: var(--cursor); transition: 0.2s; }
.inv-btn:hover { background: var(--purple-ink); color: white; }
.inv-btn-topbar { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 0.8rem; background: #e8eaf6; color: var(--purple-ink); border: 2px solid var(--purple-ink); border-radius: 8px; padding: 5px 14px; cursor: pointer; transition: 0.15s; display: none; }
.inv-btn-topbar:hover { background: var(--purple-ink); color: white; }

/* ============================================================
   MODAL / OVERLAY
   ============================================================ */

#modal-overlay { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(44, 36, 22, 0.55); align-items: center; justify-content: center; backdrop-filter: blur(2px); }
#modal-box { background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 24px 28px; max-width: 520px; width: 90%; max-height: 92vh; overflow-y: auto; box-shadow: 6px 8px 0 rgba(44, 36, 22, 0.18); font-family: 'Montserrat', sans-serif; font-size: 15px; position: relative; }

.m-title { font-size: 20px; font-weight: 900; margin-bottom: 6px; color: var(--ink); }
.m-sub { font-size: 13px; color: var(--ink3); margin-bottom: 12px; line-height: 1.5; }
.m-btn { display: block; width: 100%; background: white; color: var(--ink); border: 2px solid var(--ink3); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: 700; margin-top: 6px; text-align: left; transition: background 0.12s; }
.m-btn:hover { background: var(--yellow-hl); }
.m-btn-primary { background: var(--blue-ink); color: #fff; border-color: var(--ink); }
.m-btn-primary:hover { background: #1a3f7a; }

/* ============================================================
   QUESTION OVERLAY
   ============================================================ */

.question-overlay { position: fixed; inset: 0; background: rgba(44, 36, 22, 0.55); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.question-card { background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; padding: 30px; max-width: 480px; width: 90%; box-shadow: 10px 10px 0 var(--shadow); position: relative; transform: rotate(-1deg); font-family: 'Montserrat', sans-serif; }
.question-card .tape-piece { position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(-1deg); }
.question-prompt { font-weight: 700; font-size: 1rem; color: var(--ink); margin: 20px 0; line-height: 1.6; white-space: pre-line; }
.question-options { display: flex; flex-direction: column; gap: 10px; }
.question-opt-btn { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 0.9rem; background: white; color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; padding: 12px 16px; cursor: var(--cursor); text-align: left; box-shadow: 3px 3px 0 var(--shadow2); will-change: transform, background-color; transition: transform 0.1s ease-out, background-color 0.1s ease-out !important; transform: translateZ(0); }
.question-opt-btn:hover { background: var(--yellow-hl); transform: scale(1.02); box-shadow: 2px 2px 0 var(--shadow2); }
.question-opt-btn.correct { background: #c8e6c9; border-color: var(--green-ink); color: var(--green-ink); }
.question-opt-btn.wrong { background: #ffcdd2; border-color: var(--red-ink); color: var(--red-ink); }

/* ============================================================
   CHOICE MODAL
   ============================================================ */

.choice-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.choice-opt { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 2.5px solid var(--ink3); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: 0.15s; font-family: 'Montserrat', sans-serif; }
.choice-opt:hover { background: var(--yellow-hl); border-color: var(--ink); transform: translateY(-1px); box-shadow: 3px 3px 0 var(--shadow2); }
.ci { font-size: 1.5rem; flex-shrink: 0; }
.cl { font-weight: 900; font-size: 0.95rem; color: var(--ink); }
.cd { font-size: 0.75rem; font-weight: 600; color: var(--ink3); margin-top: 2px; }
.logic-gamble-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
#gamble-question-area { display: none; }

/* ============================================================
   INVENTORY MODAL
   ============================================================ */

.inventory-overlay { position: fixed; inset: 0; background: rgba(44, 36, 22, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.inventory-card { background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; padding: 28px; max-width: 400px; width: 90%; box-shadow: 10px 10px 0 var(--shadow); font-family: 'Montserrat', sans-serif; }
.inventory-card h2 { font-weight: 900; font-size: 1.3rem; color: var(--ink); margin-bottom: 16px; border-bottom: 2px dashed var(--line); padding-bottom: 8px; }
.inventory-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border: 2px solid var(--line); border-radius: 8px; margin-bottom: 8px; font-weight: 700; font-size: 0.85rem; background: white; gap: 10px; }
.inventory-item .item-info { flex: 1; }
.item-name { font-weight: 900; font-size: 0.9rem; color: var(--ink); }
.item-desc { font-size: 0.72rem; color: var(--ink3); margin-top: 2px; }
.inventory-use-btn { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 0.75rem; background: var(--pencil2); color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; padding: 5px 12px; cursor: pointer; transition: 0.15s; flex-shrink: 0; }
.inventory-use-btn:hover { background: var(--orange-hl); }
.close-btn { width: 100%; margin-top: 14px; font-family: 'Montserrat', sans-serif; font-weight: 900; background: var(--ink); color: var(--paper); border: none; border-radius: 10px; padding: 10px; cursor: var(--cursor); transition: 0.2s; }
.close-btn:hover { background: var(--red-ink); }

/* ============================================================
   WINNER SCREEN
   ============================================================ */

.winner-overlay { position: fixed; inset: 0; background: rgba(44, 36, 22, 0.7); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.winner-card { background: var(--paper); border: 5px solid var(--ink); border-radius: 20px; padding: 40px; text-align: center; box-shadow: 12px 12px 0 var(--shadow); font-family: 'Montserrat', sans-serif; transform: rotate(-2deg); max-width: 400px; width: 90%; }
.winner-card h1 { font-weight: 900; font-size: 2.5rem; color: var(--ink); text-shadow: 3px 3px 0 var(--yellow-hl); margin-bottom: 10px; }
.winner-card p { font-weight: 700; font-size: 1.1rem; color: var(--ink2); margin-bottom: 20px; }
.play-again-btn { font-family: 'Montserrat', sans-serif; font-weight: 900; font-size: 1.1rem; background: var(--pencil2); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; padding: 14px 30px; cursor: var(--cursor); box-shadow: 6px 6px 0 var(--shadow); transition: 0.2s; }
.play-again-btn:hover { background: var(--orange-hl); transform: scale(1.05); }

/* ============================================================
   RESPONSIVE — 1024px (small laptops / large tablets landscape)
   ============================================================ */

@media (max-width: 1024px) {
	/* Menu: shrink proportions */
	.menu { width: 35%; }
	.menu-side { width: 65%; }
	.menu h1 { font-size: 3.5em; }
	.menu-btn { font-size: 1.2em; margin-left: 1.5em; }

	/* Game: narrow side panels */
	.game-left, .game-right { width: 200px; }

	/* Board: tighter */
	#board-container { width: min(480px, calc(100vh - 200px)) !important; height: min(480px, calc(100vh - 200px)) !important; }
}

/* ============================================================
   RESPONSIVE — 768px (tablets portrait)
   ============================================================ */

@media (max-width: 768px) {
	/* ── Menu screen: stack vertically ── */
	.screen.active { flex-direction: column; overflow-y: auto; }
	.menu { width: 100%; min-height: auto; border-right: none; border-bottom: 6px solid var(--ink3); padding: 30px 20px 20px; flex-direction: column; align-items: center; justify-content: center; }
	.menu-content { align-items: center; }
	.menu h1 { font-size: 3em; margin-left: 0; text-align: center; }
	.menu-btn { width: 80%; margin-left: 0; font-size: 1.1em; padding: 0.5em 1.5em; }
	.menu-side { width: 100%; height: auto; min-height: 0; padding: 20px 0 40px; }

	/* Setup sections */
	.setup-section { max-width: 100%; margin: 0 10px; }
	.squad-container { max-width: 100%; padding: 40px 15px 20px; gap: 16px; }

	/* Rules */
	#menuRules { padding: 20px; }
	.ability-guide-grid { grid-template-columns: 1fr; padding: 10px; }
	.soo-explain-grid { gap: 12px; }

	/* Ducks tab */
	#menuDucks .squad-container { gap: 16px; padding: 50px 12px 30px; max-height: none; }

	/* ── Game screen: vertical layout ── */
	#screen-game { overflow-y: auto; height: 100%; }
	.game-body { flex-direction: column; gap: 8px; padding: 8px; overflow: visible; }

	/* Side panels: horizontal scrolling strips at top/bottom */
	.game-left, .game-right { width: 100%; flex-direction: row; flex-shrink: 0; overflow-x: auto; overflow-y: hidden; gap: 8px; padding: 8px; border-right: none; border-left: none; border-bottom: 2px dashed var(--line); min-height: 0; height: auto; }
	.game-right { border-bottom: none; border-top: 2px dashed var(--line); }
	.player-card { min-width: 180px; flex-shrink: 0; }

	/* Center: fill remaining height */
	.game-center { padding: 6px; gap: 6px; }

	/* Board: use viewport width on mobile */
	#board-container { width: min(96vw, calc(100svh - 340px)) !important; height: min(96vw, calc(100svh - 340px)) !important; }
	.board-wrap { overflow: visible !important; min-height: 0; }

	/* Turn bar */
	.turn-bar { padding: 8px 12px; }
	.turn-name { font-size: 0.95rem; }
	.turn-info { font-size: 0.72rem; }

	/* Top bar: compress */
	.game-topbar { padding: 8px 12px; flex-wrap: wrap; gap: 6px; }
	.game-title { font-size: 1rem; }
	.legend-bar { gap: 6px; }
	.leg-chip { font-size: 0.65rem; }

	/* Roll screen */
	#screen-roll { padding: 20px; }
	#screen-roll h1 { font-size: 1.8rem; }
	.roll-cards-grid { gap: 14px; }
	.roll-card { width: 160px; padding: 14px; min-height: 130px; }

	/* Dice: slightly smaller */
	.container-dice { width: 52px; height: 52px; }
	.dice .side { width: 52px; height: 52px; }
	.dice .side:nth-child(1) { transform: rotateY(0deg) translateZ(26px); }
	.dice .side:nth-child(2) { transform: rotateY(180deg) translateZ(26px); }
	.dice .side:nth-child(3) { transform: rotateY(90deg) translateZ(26px); }
	.dice .side:nth-child(4) { transform: rotateY(-90deg) translateZ(26px); }
	.dice .side:nth-child(5) { transform: rotateX(90deg) translateZ(26px); }
	.dice .side:nth-child(6) { transform: rotateX(-90deg) translateZ(26px); }

	/* Modals: full-width on tablet */
	#modal-box { padding: 18px 16px; max-width: 96vw; }
	.question-card { padding: 22px 16px; max-width: 96vw; }
}

@media (max-width: 768px) {
	.game-right { 
		width: 100%; 
		flex-direction: column; /* Force vertical stacking */
		height: auto; 
		overflow-y: visible; 
		border-top: 2px dashed var(--line); 
		gap: 15px; /* Add space between SOO and Log */
	}

	.soo-wrap { 
		width: 100%; 
		margin-bottom: 10px; 
	}

	.panel { 
		width: 100%; 
		min-height: 200px; /* Give the log some vertical space */
		max-height: 300px; 
	}
}

/* ============================================================
   RESPONSIVE — 480px (phones)
   ============================================================ */

@media (max-width: 480px) {
	/* ── Menu ── */
	.menu { padding: 20px 14px 16px; }
	.menu h1 { font-size: 2.2em; }
	.menu-btn { font-size: 1em; padding: 0.5em 1em; width: 85%; }
	#menuRules { padding: 12px; gap: 0; }
	.tape-piece { font-size: 1.1rem; padding: 3px 14px; }

	/* Setup: single-column opt cards */
	.option-row { flex-direction: column; gap: 8px; }
	.opt-card { min-width: unset; }
	.setup-section { padding: 14px; border-radius: 10px; }
	.setup-section h3 { font-size: 1rem; }
	.start-btn { font-size: 1rem; padding: 12px; }

	/* Duck cards: single column */
	.squad-container { grid-template-columns: 1fr; gap: 12px; padding: 32px 10px 16px; }
	#menuDucks .squad-container { grid-template-columns: 1fr; }
	.ability-guide-grid { grid-template-columns: 1fr; }
	.duck-card h3 { font-size: 1.2rem; }
	.duck-card p { font-size: 0.95rem; }

	/* ── Game topbar: icon-only legend on very small screens ── */
	.legend-bar { display: none; }
	.game-topbar { justify-content: space-between; }
	.game-title { font-size: 0.85rem; letter-spacing: 1px; }

	/* Player cards in horizontal strip: narrower */
	.player-card { min-width: 150px; padding: 8px; }
	.pcard-name { font-size: 0.85rem; }
	.pcard-char { font-size: 0.65rem; }

	/* Board: full width */
	#board-container { width: 98vw !important; height: 98vw !important; }

	/* Dice: smaller on phone */
	.container-dice { width: 44px; height: 44px; }
	.dice .side { width: 44px; height: 44px; }
	.dice .side:nth-child(1) { transform: rotateY(0deg) translateZ(22px); }
	.dice .side:nth-child(2) { transform: rotateY(180deg) translateZ(22px); }
	.dice .side:nth-child(3) { transform: rotateY(90deg) translateZ(22px); }
	.dice .side:nth-child(4) { transform: rotateY(-90deg) translateZ(22px); }
	.dice .side:nth-child(5) { transform: rotateX(90deg) translateZ(22px); }
	.dice .side:nth-child(6) { transform: rotateX(-90deg) translateZ(22px); }
	.dot { width: 7px; height: 7px; }
	.dice-row { gap: 12px; }
	.roll-btn { font-size: 0.85rem; padding: 8px 18px; }
	.center-dice-overlay { gap: 8px; padding-top: 20px; }
	.center-logo-text { font-size: 1.1rem; }

	/* Turn bar */
	.turn-bar { padding: 6px 10px; }
	.turn-name { font-size: 0.85rem; }

	/* Roll screen */
	#screen-roll { padding: 14px; gap: 12px; }
	#screen-roll h1 { font-size: 1.4rem; }
	.roll-cards-grid { gap: 10px; }
	.roll-card { width: 140px; padding: 12px; min-height: 110px; }
	.rc-name { font-size: 0.85rem; }

	/* Modals: full screen on phone */
	#modal-box { width: 96vw; max-width: unset; padding: 14px 12px; border-radius: 10px; font-size: 13px; }
	.question-card { width: 96vw; max-width: unset; padding: 18px 12px; border-radius: 12px; transform: none; }
	.question-prompt { font-size: 0.88rem; margin: 14px 0; }
	.question-opt-btn { font-size: 0.8rem; padding: 10px 12px; }
	.m-title { font-size: 17px; }
	.m-btn { font-size: 13px; padding: 7px 10px; }
	.choice-opt { padding: 10px; gap: 8px; }
	.ci { font-size: 1.2rem; }

	/* Winner card */
	.winner-card { padding: 24px; transform: none; }
	.winner-card h1 { font-size: 1.8rem; }
	.play-again-btn { padding: 10px 20px; font-size: 1rem; }
}

/* ============================================================
   RESPONSIVE — landscape phones (short viewport)
   ============================================================ */

@media (max-height: 500px) and (orientation: landscape) {
	/* Menu: side-by-side stays but compress heights */
	.menu { min-height: 100vh; padding: 10px 20px; }
	.menu h1 { font-size: 2rem; }
	.menu-btn { font-size: 0.9em; margin-bottom: 0.8em; padding: 0.3em 1em; }
	.menu-side { padding: 10px 0; }

	/* Game: board gets smaller, panels stay horizontal */
	#board-container { width: min(80vw, calc(100svh - 120px)) !important; height: min(80vw, calc(100svh - 120px)) !important; }
	.game-left, .game-right { max-height: 90px; }
	.player-card { min-width: 150px; }
	.game-topbar { padding: 4px 12px; }
	.game-body { gap: 4px; padding: 4px; }
	.turn-bar { padding: 5px 10px; }
	.center-dice-overlay { gap: 6px; padding-top: 10px; }
	.container-dice { width: 40px; height: 40px; }
	.dice .side { width: 40px; height: 40px; }
	.dice .side:nth-child(1) { transform: rotateY(0deg) translateZ(20px); }
	.dice .side:nth-child(2) { transform: rotateY(180deg) translateZ(20px); }
	.dice .side:nth-child(3) { transform: rotateY(90deg) translateZ(20px); }
	.dice .side:nth-child(4) { transform: rotateY(-90deg) translateZ(20px); }
	.dice .side:nth-child(5) { transform: rotateX(90deg) translateZ(20px); }
	.dice .side:nth-child(6) { transform: rotateX(-90deg) translateZ(20px); }
	.roll-btn { padding: 6px 14px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .game-right {
        flex-direction: column;
    }

    .soo-rels {
        font-size: 0.65rem;
    }

    .panel {
        min-height: 180px;
    }
}
