.seven-main {
    width: 100%;
    padding: 0 0 48px;
    background:
        radial-gradient(circle at 12% 18%, rgba(24, 119, 132, .08), transparent 28%),
        radial-gradient(circle at 88% 72%, rgba(214, 100, 45, .08), transparent 30%),
        var(--color-canvas);
}

.seven-page-header {
    color: #fff;
    background: linear-gradient(115deg, #183b50 0%, #176776 54%, #2f8290 100%);
    border-bottom: 4px solid #e89b3c;
}

.seven-header-inner {
    width: min(940px, 100%);
    margin: 0 auto;
    padding: 14px 20px 18px;
}

.back-link {
    display: inline-block;
    color: #fff;
    font-size: .9rem;
    font-weight: 700;
    text-underline-offset: 3px;
}

.seven-eyebrow {
    margin: 8px 0 1px;
    color: #ffe1b1;
    font-size: .74rem;
    font-weight: 900;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.seven-page-header h1 {
    margin: 0;
    font-size: clamp(2rem, 6vw, 3.25rem);
    line-height: 1;
}

.seven-page-header p:last-child {
    margin: 6px 0 0;
    color: #e8f8fa;
    font-size: 1rem;
}

button { touch-action: manipulation; }

.seven-game-card {
    width: min(780px, calc(100% - 28px));
    margin: 22px auto 0;
    padding: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 18px;
    box-shadow: var(--shadow-card);
}

.game-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.game-topline h2,
.game-topline p { margin: 0; }
.game-topline p { margin-top: 4px; color: var(--color-muted); }
.game-topline-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.game-topline-actions .text-button { display: grid; place-items: center; text-decoration: none; }

.seven-game-card > .save-panels,
.seven-game-card > .opponent-panel { display: none; }

.online-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}
.online-actions[hidden] { display: none; }

.save-panels {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.save-panel {
    padding: 11px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid #b9d0d4;
    border-radius: 11px;
    background: #f1fafb;
}
.save-panel h3,
.save-panel p { margin: 0; }
.save-panel h3 { font-size: .92rem; }
.save-panel p { margin-top: 3px; color: var(--color-muted); font-size: .78rem; line-height: 1.35; }
.save-panel button { flex: 0 0 auto; }
.save-panel button:disabled { cursor: default; opacity: .5; }
.account-save-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.text-button { display: inline-grid; place-items: center; text-decoration: none; }
.text-button[hidden] { display: none; }
.account-save-panel { align-items: center; }

.opponent-panel {
    margin-top: 16px;
    padding: 13px 14px;
    display: grid;
    grid-template-columns: minmax(160px, .8fr) minmax(300px, 1.2fr);
    align-items: center;
    gap: 14px;
    border: 1px solid #d8c9b8;
    border-radius: 12px;
    background: #fff9ef;
}
.opponent-panel h3,
.opponent-panel p { margin: 0; }
.opponent-panel h3 { font-size: 1rem; }
.opponent-panel p { margin-top: 4px; color: var(--color-muted); font-size: .82rem; line-height: 1.35; }
.opponent-controls { display: grid; gap: 9px; }
.mode-buttons,
.difficulty-buttons,
.color-buttons { display: grid; gap: 6px; }
.mode-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.difficulty-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.color-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode-buttons button,
.difficulty-buttons button,
.color-buttons button {
    min-width: 0;
    min-height: 42px;
    padding: 7px 9px;
    color: var(--color-ink);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
}
.mode-buttons button:hover,
.difficulty-buttons button:hover,
.color-buttons button:hover { background: #f7ead9; }
.mode-buttons button[aria-pressed="true"],
.difficulty-buttons button[aria-pressed="true"],
.color-buttons button[aria-pressed="true"] {
    color: #fff;
    background: #205d6b;
    border-color: #174957;
}
.difficulty-control,
.color-control { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 9px; }
.difficulty-control[hidden] { display: none; }
.difficulty-control > span,
.color-control > span { color: var(--color-muted); font-size: .78rem; font-weight: 800; }
.color-buttons button { display: flex; align-items: center; justify-content: center; gap: 6px; }
.color-swatch { width: 17px; height: 17px; border: 1px solid #263942; border-radius: 50%; }
.color-swatch.blue { background: #25b8cf; }
.color-swatch.orange { background: #f08243; }

.secondary-button,
.danger-button {
    min-height: 44px;
    padding: 9px 14px;
    border: 1px solid var(--color-border);
    border-radius: 9px;
    color: var(--color-ink);
    background: #fff;
    font-weight: 800;
    cursor: pointer;
}

.secondary-button:hover { background: #f7ead9; }
.danger-button { color: #fff; background: #9c342c; border-color: #7f2822; }
.danger-button:hover { background: #7f2822; }
.mode-accept-button {
    min-height: 44px;
    padding: 9px 14px;
    color: #fff;
    background: #176776;
    border: 1px solid #0f5260;
    border-radius: 9px;
    font-weight: 900;
    cursor: pointer;
}
.mode-accept-button:hover { background: #0f5260; }

.player-strip {
    margin: 18px 0 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
}

.player-card {
    min-width: 0;
    padding: 9px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 2px solid transparent;
    border-radius: 11px;
    background: #f3eee6;
    opacity: .68;
}

.player-card.current {
    opacity: 1;
    border-color: currentColor;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}

.player-card.winner { opacity: 1; border-color: #347044; background: #e8f6ea; }
.player-one { color: #11697b; }
.player-two { color: #b64d20; }
.player-card.color-blue { color: #11697b; }
.player-card.color-orange { color: #b64d20; }
.player-card strong, .player-card small { display: block; }
.player-card strong { color: var(--color-ink); }
.player-card small { margin-top: 2px; color: var(--color-muted); font-size: .72rem; }

.player-color {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 2px solid #263942;
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .48);
}

.player-card.color-blue .player-color { background: #23a9c0; }
.player-card.color-orange .player-color { background: #ef7b3e; }

.turn-marker {
    align-self: center;
    max-width: 132px;
    padding: 7px 10px;
    color: #fff;
    background: #263f4b;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 900;
    text-align: center;
}

.disc-picker {
    padding: 14px;
    border: 1px solid #d8c9b8;
    border-radius: 13px;
    background: #fff9ef;
}

.picker-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.picker-heading h3,
.board-panel h3 { margin: 0; font-size: 1rem; }
.picker-heading span { color: var(--color-muted); font-size: .82rem; font-weight: 700; }

.disc-options {
    width: min(430px, 100%);
    margin: 10px auto 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.disc-choice {
    min-height: 64px;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: var(--color-ink);
    background: #fff;
    border: 2px solid #cdb9a3;
    border-radius: 12px;
    font-weight: 800;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
}

.disc-choice:hover { background: #fff2d8; }
.disc-choice:active { cursor: grabbing; }
.disc-choice[aria-pressed="true"] {
    border-color: #263f4b;
    background: #fff0cb;
    box-shadow: 0 0 0 3px #efb956;
}
.disc-choice:disabled { cursor: default; opacity: .48; }

.choice-disc,
.disc {
    display: grid;
    place-items: center;
    border: 2px solid #263942;
    border-radius: 50%;
    color: #102c36;
    background: #d7edf0;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .52), 0 2px 4px rgba(24, 36, 42, .25);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.choice-disc { width: 40px; height: 40px; flex: 0 0 40px; font-size: 1.15rem; }
.drag-help { margin: 9px 0 0; color: var(--color-muted); font-size: .82rem; text-align: center; }

.board-panel { margin-top: 16px; text-align: center; }
.board-panel h3 { margin-bottom: 7px; }

.seven-board-shell {
    --board-size: min(560px, calc(100vw - 72px));
    width: var(--board-size);
    margin: 0 auto;
}

.drop-controls {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    padding: 0 5px 5px;
}

.drop-controls button {
    min-width: 0;
    min-height: 45px;
    padding: 3px 1px;
    display: grid;
    place-items: center;
    color: #174c5a;
    background: #e5f5f6;
    border: 1px solid #83b6be;
    border-radius: 9px 9px 5px 5px;
    font-weight: 900;
    line-height: .9;
    cursor: pointer;
}

.drop-controls .column-number { font-size: .82rem; }
.drop-controls button:hover,
.drop-controls button.drag-over { color: #fff; background: #176b79; }
.drop-controls button.legal-three {
    color: #fff;
    background: #28794a;
    border-color: #185b35;
    box-shadow: 0 0 0 2px rgba(40, 121, 74, .2);
}
.drop-controls button.illegal-three { opacity: .48; }
.drop-controls button.invalid-drop { color: #fff; background: #a43731; border-color: #7e2925; }
.drop-controls button:disabled { color: #887d72; background: #e4ddd5; border-color: #cfc2b4; cursor: default; }

.seven-board {
    width: 100%;
    aspect-ratio: 1;
    padding: 7px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: repeat(7, minmax(0, 1fr));
    gap: 3px;
    overflow: hidden;
    border: 5px solid #153d52;
    border-radius: 16px 16px 11px 11px;
    background: linear-gradient(145deg, #24788d, #12576c 58%, #0e465b);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25), 0 8px 16px rgba(20, 55, 69, .2);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.seven-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: visible;
    border-radius: 50%;
    background: #eef3ec;
    box-shadow: inset 0 4px 7px rgba(17, 51, 65, .38);
    cursor: pointer;
}

.seven-cell::after {
    content: "";
    position: absolute;
    inset: 1px;
    z-index: 2;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
}

.seven-cell.red-cell::before {
    content: "";
    position: absolute;
    inset: 1px;
    z-index: 3;
    pointer-events: none;
    border: clamp(2px, .45vw, 4px) solid #c42f32;
    border-radius: 9px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .72);
}

.seven-cell.column-hover { background: #fff0c9; }
.seven-cell.invalid-drop { background: #f6c8c3; }
.seven-cell.legal-three-target {
    background: #dcf4df;
    box-shadow: inset 0 4px 7px rgba(17, 51, 65, .38), 0 0 0 3px #70b77c;
}

.disc {
    position: relative;
    z-index: 1;
    width: 88%;
    height: 88%;
    font-size: clamp(1rem, 5vw, 2rem);
}

.disc.player-0,
.choice-disc.player-0 { color: #052e38; background: #25b8cf; }
.disc.player-1,
.choice-disc.player-1 { color: #421706; background: #f08243; }

.disc.is-dropping {
    animation: seven-drop .42s cubic-bezier(.25, .72, .38, 1.08) both;
}

@keyframes seven-drop {
    from { transform: translateY(var(--drop-distance)); }
    to { transform: translateY(0); }
}

.seven-cell.winning-cell {
    z-index: 3;
    background: #fff2a8;
    box-shadow: 0 0 0 3px #ffd138, 0 0 18px 6px rgba(255, 209, 56, .72);
}

.winning-cell .disc { animation: winner-pulse .82s ease-in-out infinite alternate; }
@keyframes winner-pulse { to { transform: scale(.9); filter: brightness(1.12); } }

.game-status {
    min-height: 2.9em;
    margin: 13px auto 0;
    display: grid;
    place-items: center;
    color: var(--color-muted);
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.game-status.success { color: #246b3f; font-size: 1.08rem; }
.game-status.stalemate { color: #744b22; }
.game-status.warning { color: #9a382d; }

.rules-card {
    margin-top: 12px;
    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 12px; line-height: 1.55; }
.rules-content p:first-child { margin-top: 0; }

.restart-dialog {
    width: min(420px, calc(100% - 30px));
    padding: 0;
    color: var(--color-ink);
    background: var(--color-surface);
    border: 2px solid var(--color-brand);
    border-radius: 15px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
}
.restart-dialog::backdrop { background: rgba(28, 20, 16, .58); }
.restart-dialog form { padding: 25px; }
.restart-dialog h2 { margin: 0; }
.restart-dialog p { color: var(--color-muted); }
.dialog-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 9px; }
.mode-change-dialog strong { color: var(--color-ink); }

.new-game-dialog {
    width: min(760px, calc(100% - 28px));
    max-height: calc(100vh - 32px);
    padding: 0;
    color: var(--color-ink);
    background: #f8f4ed;
    border: 2px solid #176776;
    border-radius: 18px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .38);
}
.new-game-dialog::backdrop { background: rgba(20, 34, 39, .66); }
.new-game-dialog form { padding: 22px; }
.new-game-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.new-game-heading h2, .new-game-heading p { margin: 0; }
.new-game-heading .seven-eyebrow { color: #8c461f; }
.dialog-close {
    width: 44px;
    height: 44px;
    border: 1px solid #ad9c87;
    border-radius: 50%;
    background: #fff;
    font-size: 1.65rem;
    line-height: 1;
    cursor: pointer;
}
.new-game-section {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid #c9bba9;
    border-radius: 13px;
    background: #fff;
}
.new-game-section h3 { margin: 0 0 10px; }
.new-game-section > p { margin: 0 0 11px; color: var(--color-muted); }
.new-game-section .save-panels { margin: 0 0 12px; }
.new-game-options { margin-top: 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.new-game-options label, .email-challenge-label { display: grid; gap: 5px; color: #455b64; font-size: .8rem; font-weight: 800; }
.new-game-options label small { color: var(--color-muted); font-size: .72rem; font-weight: 600; line-height: 1.35; }
.new-game-options select, .email-challenge-label input {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    color: var(--color-ink);
    background: #fff;
    border: 1px solid #9fb0b5;
    border-radius: 8px;
    font: inherit;
}
.email-challenge-label { margin-top: 11px; }
.new-game-primary {
    min-height: 44px;
    margin-top: 12px;
    padding: 9px 15px;
    color: #fff;
    background: #176776;
    border: 1px solid #0f5260;
    border-radius: 9px;
    font-weight: 900;
    cursor: pointer;
}
.online-new-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.new-game-message { min-height: 1.4em; margin-top: 9px !important; color: #9a382d !important; font-weight: 700; }
.mobile-dialog-scroll-space { display: none; }

@media (min-width: 621px) {
    .disc-picker { padding: 9px 14px 8px; display: flex; flex-direction: column; }
    .picker-heading { order: 1; }
    .drag-help { order: 2; margin-top: 2px; }
    .disc-options { order: 3; margin-top: 7px; }
    .disc-choice { min-height: 54px; padding-block: 5px; }
    .board-panel { margin-top: 9px; }
    .board-panel h3 { margin-bottom: 4px; }
    .drop-controls { padding-bottom: 3px; }
    .drop-controls button { min-height: 32px; }
}

@media (max-width: 620px) {
    .site-frame[data-page="seven"] {
        min-height: 100vh;
        min-height: 100svh;
        height: auto;
        overflow: visible;
    }
    .site-frame[data-page="seven"] .site-main { overflow-y: visible; }
    .seven-main { padding-bottom: 30px; }
    .seven-header-inner { padding: 11px 12px 14px; }
    .seven-game-card { width: calc(100% - 12px); margin-top: 8px; padding: 14px 8px; border-radius: 13px; }
    .game-topline { padding: 0 3px; }
    .game-topline h2 { font-size: 1.2rem; }
    .game-topline p { font-size: .84rem; }
    .save-panels { grid-template-columns: 1fr; }
    .save-panel { padding: 9px; }
    .save-panel p { font-size: .73rem; }
    .opponent-panel { grid-template-columns: 1fr; gap: 10px; padding: 11px 9px; }
    .opponent-panel > div:first-child { text-align: center; }
    .mode-buttons button, .difficulty-buttons button, .color-buttons button { min-height: 44px; padding-inline: 5px; }
    .player-strip { grid-template-columns: 1fr 1fr; }
    .turn-marker { grid-column: 1 / -1; grid-row: 2; justify-self: center; max-width: none; padding-inline: 16px; }
    .player-card { padding: 7px; }
    .disc-picker { padding: 11px 7px; }
    .choice-label { display: none; }
    .disc-choice { min-height: 58px; padding: 5px; }
    .seven-board-shell { --board-size: min(560px, calc(100vw - 26px)); }
    .seven-board { padding: 5px; gap: 2px; border-width: 4px; border-radius: 12px 12px 9px 9px; }
    .drop-controls { padding-inline: 3px; }
    .dialog-actions { flex-direction: column-reverse; }
    .dialog-actions > * { width: 100%; }
    .new-game-dialog {
        width: 100%;
        max-width: none;
        max-height: 100vh;
        max-height: 100svh;
        height: 100vh;
        height: 100svh;
        margin: 0;
        border: 0;
        border-radius: 0;
    }
    .new-game-dialog form { min-height: 100%; padding: 16px 12px 28px; overflow-y: auto; }
    .new-game-section { padding: 13px 10px; }
    .new-game-options { grid-template-columns: 1fr; }
    .new-game-section .save-panels { display: grid; }
    .online-new-actions { display: grid; }
    .online-new-actions > * { width: 100%; }
    .mobile-dialog-scroll-space {
        min-height: 180px;
        margin-top: 14px;
        padding: 16px 14px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        color: #455b64;
        background: #f1fafb;
        border: 1px solid #b9d0d4;
        border-radius: 13px;
        font-size: .82rem;
        line-height: 1.4;
    }
    .mobile-dialog-scroll-space strong { color: var(--color-ink); font-size: .9rem; }
}

@media (max-width: 350px) {
    .player-color { width: 24px; height: 24px; flex-basis: 24px; }
    .player-card strong { font-size: .87rem; }
    .picker-heading span { font-size: .75rem; }
    .disc { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .disc.is-dropping,
    .winning-cell .disc { animation: none; }
}

/* Hide the game board while a homepage entry is resolving the signed-in destination. */
html.seven-entry-pending body { visibility: hidden; }
