.futoshiki-main { width: 100%; padding: 0 0 54px; }
.futoshiki-page-header { padding: 20px 22px; color: #fff; background: var(--color-brand); border-bottom: 4px solid var(--color-accent); }
.futoshiki-header-inner { width: min(1200px, 100%); margin: 0 auto; }
.futoshiki-header-inner h1 { margin: 0; color: #fff; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.futoshiki-header-inner p { margin: 7px 0 0; color: #f3dfce; }
.futoshiki-page-header .back-link { display: inline-block; margin-bottom: 9px; color: #fff; font-size: .88rem; font-weight: 700; text-underline-offset: 3px; }
.board-section { width: min(760px, calc(100% - 40px)); margin: 22px auto 0; padding: 26px; text-align: center; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; box-shadow: var(--shadow-card); }
.board-section > h2 { margin: 0 0 15px; }
.difficulty-panel { width: min(540px, 100%); margin: 0 auto 16px; padding: 14px 16px; background: #fffaf2; border: 1px solid var(--color-border); border-radius: 10px; }
.difficulty-panel h3 { margin: 0; font-size: 1rem; }
.difficulty-buttons, .game-options, .number-pad { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.difficulty-buttons { margin: 10px 0 7px; }
.game-options { margin: 0 0 18px; }
.difficulty-panel button, .game-options button, .number-pad button, .celebration button { min-height: 44px; min-width: 100px; padding: 9px 12px; color: var(--color-ink); background: #fff; border: 1px solid var(--color-border); border-radius: 9px; font: inherit; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.difficulty-buttons button { flex: 1 1 100px; }
.difficulty-panel button:hover, .game-options button:hover, .number-pad button:hover, .celebration button:hover { background: #f7ead9; }
.difficulty-buttons button.active, .game-options button[aria-pressed="true"] { color: #fff; background: var(--color-brand-strong); border-color: var(--color-brand-strong); }
button:disabled { cursor: default; opacity: .5; }
#status { min-height: 1.5em; margin: 0; color: var(--color-muted); font-size: .86rem; line-height: 1.5; }
#status.success-status { color: #246b3f; font-weight: 700; }
#status.error-status { color: #8b2f2f; font-weight: 700; }
.futoshiki-board { --gap: 34px; width: min(100%, 430px); aspect-ratio: 1; margin: 18px auto 0; padding: 3px; display: grid; grid-template-columns: repeat(var(--gaps), minmax(0, 1fr) var(--gap)) minmax(0, 1fr); grid-template-rows: repeat(var(--gaps), minmax(0, 1fr) var(--gap)) minmax(0, 1fr); background: #fff; border: 3px solid var(--color-brand-strong); border-radius: 3px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.futoshiki-board .f-cell { min-width: 0; min-height: 0; width: 100%; height: 100%; padding: 0; display: grid; place-items: center; border: 1px solid #bcae9e; border-radius: 2px; background: #fff; color: var(--color-brand); font-family: inherit; font-size: clamp(1.35rem, 5vw, 2rem); font-weight: 700; line-height: 1; cursor: pointer; opacity: 1; }
.futoshiki-board .f-cell.fixed { background: #f7f0e7; color: var(--color-ink); font-weight: 800; cursor: default; }
.futoshiki-board .f-cell.selected { background: #fff1d8; outline: 3px solid var(--color-accent); outline-offset: -3px; }
.futoshiki-board .f-cell:focus-visible { outline: 3px solid var(--color-accent); outline-offset: -3px; z-index: 1; }
.futoshiki-board .f-cell.conflict { color: #8b2f2f; background: #ffe2df; }
.sign-slot { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.sign-slot.clue { color: #3d2d21; font: 800 clamp(1.1rem, 5vw, 1.65rem)/1 Arial, sans-serif; }
.sign-slot.vertical { position: relative; flex-direction: column; gap: 0; font-size: clamp(.9rem, 4vw, 1.3rem); }
.sign-slot.vertical::before, .sign-slot.vertical::after { position: absolute; left: 0; width: 100%; font: 700 7px/1 Arial, sans-serif; letter-spacing: -.3px; text-align: center; text-transform: uppercase; color: #765d47; content: attr(data-top); }
.sign-slot.vertical::before { top: 0; }
.sign-slot.vertical::after { bottom: 0; content: attr(data-bottom); }
.number-pad { width: min(100%, 430px); margin: 15px auto 0; }
.number-pad button { flex: 1 1 44px; min-width: 44px; }
.tap-help { margin: 14px 0 0; color: var(--color-muted); font-size: .92rem; }
.rules-card { width: min(100%, 540px); margin: 20px auto 0; text-align: left; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; }
.rules-card summary { padding: 13px 15px; font-weight: 800; cursor: pointer; }
.rules-content { padding: 0 16px 14px; line-height: 1.55; }
.rules-content p:first-child { margin-top: 0; }
.video-tutorial { width: min(100%, 640px); margin: 24px auto 0; text-align: left; }
.video-tutorial h2 { margin: 0 0 7px; font-size: 1.25rem; text-align: center; }
.video-tutorial p { margin: 0 0 12px; color: var(--color-muted); line-height: 1.5; text-align: center; }
.video-frame { aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--color-border); border-radius: 10px; background: #000; box-shadow: var(--shadow-card); }
.video-frame iframe { width: 100%; height: 100%; display: block; border: 0; }
.pencil-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; color: #78573b; font: 600 clamp(.5rem, 2vw, .8rem)/1 Arial, sans-serif; }
.futoshiki-board.is-incorrect { animation: board-wobble .38s ease-in-out; }
@keyframes board-wobble { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }
.celebration[hidden] { display: none; }
.celebration { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(37, 22, 14, .62); }
.celebration-card { position: relative; z-index: 2; width: min(420px, 100%); padding: 30px; text-align: center; background: #fffaf2; border: 3px solid var(--color-accent); border-radius: 18px; box-shadow: 0 18px 60px rgba(0, 0, 0, .35); }
.celebration-kicker { margin: 0; color: var(--color-brand); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.celebration-card h2 { margin: 8px 0; }
.confetti-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-layer i { position: absolute; top: -20px; left: var(--left); width: 9px; height: 14px; background: var(--color); animation: confetti-fall 3s linear var(--delay) forwards; }
@keyframes confetti-fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(720deg); } }
@media (max-width: 760px) { .futoshiki-page-header { padding: 14px; } }
@media (max-width: 600px) {
    .futoshiki-main { padding-bottom: 36px; }
    .board-section { width: calc(100% - 20px); padding: 18px 8px; }
    .difficulty-panel { padding: 12px 10px; }
    .game-options { display: grid; grid-template-columns: repeat(2, 1fr); }
    .game-options button { min-width: 0; width: 100%; }
    .futoshiki-board { --gap: 26px; }
    .sign-slot.vertical { font-size: 12px; }
    .sign-slot.vertical::before, .sign-slot.vertical::after { font-size: 6px; }
}
@media (max-width: 350px) {
    .futoshiki-board { --gap: 16px; }
    .sign-slot.vertical { font-size: 9px; }
    .sign-slot.vertical::before, .sign-slot.vertical::after { font-size: 4px; }
}
@media (prefers-reduced-motion: reduce) { .futoshiki-board.is-incorrect, .confetti-layer i { animation: none; } }

.print-instructions, .print-credit { display: none; }
@media print {
    @page { size: letter portrait; margin: .6in; }
    html, body, .site-frame { height: auto !important; overflow: visible !important; background: #fff !important; }
    .site-frame { display: block; }
    #site-header, #site-footer, .skip-link, .back-link, .difficulty-panel, .game-options, .number-pad, .tap-help, .rules-card, .video-tutorial, .celebration { display: none !important; }
    .futoshiki-main { padding: 0; overflow: visible; }
    .futoshiki-page-header { padding: 0 0 .12in; color: #000; background: #fff; border: 0; }
    .futoshiki-header-inner { width: 100%; }
    .futoshiki-header-inner h1 { color: #000; font-size: 22pt; }
    .futoshiki-header-inner p { color: #333; font-size: 10pt; }
    .board-section { width: 100%; margin: 0; padding: 0; border: 0; box-shadow: none; break-inside: avoid; }
    .board-section > h2 { display: none; }
    .futoshiki-board { --gap: 34px !important; width: 5.3in; height: 5.3in; margin: .2in auto .25in; border: 2px solid #000; border-radius: 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    .futoshiki-board .f-cell { color: #000; background: #fff !important; border: 1px solid #666; border-radius: 0; font-size: 20pt; }
    .futoshiki-board .f-cell.fixed { opacity: 1 !important; }
    .futoshiki-board .f-cell.selected, .futoshiki-board .f-cell.conflict { outline: none; }
    .futoshiki-board .f-cell:not(.fixed) { font-size: 0 !important; }
    .futoshiki-board .f-cell:not(.fixed) * { visibility: hidden !important; }
    .sign-slot.clue { color: #000; font-size: 18pt; }
    .sign-slot.vertical { font-size: 15pt; }
    .sign-slot.vertical::before, .sign-slot.vertical::after { color: #333; font-size: 7px; }
    .print-instructions { display: block; max-width: 6.8in; margin: 0 auto; text-align: left; font-size: 10pt; line-height: 1.45; }
    .print-instructions h2 { margin: 0 0 .08in; font-size: 13pt; }
    .print-instructions p { margin: 0; }
    .print-credit { display: block; margin: .2in 0 0; color: #333; font-size: 10pt; }
}
