:root {
    --frig-bg: #17120f;
    --frig-bg-deep: #0f0b09;
    --frig-wood: #3a2418;
    --frig-wood-soft: #5b3b27;
    --frig-cork: #91633b;
    --frig-cork-soft: #b08156;
    --frig-paper: #f2e3c6;
    --frig-paper-soft: #faefd9;
    --frig-paper-aged: #ddc29d;
    --frig-paper-line: #d4b68b;
    --frig-ink: #2a1d15;
    --frig-ink-soft: #6f5642;
    --frig-ink-faint: #91755c;
    --frig-brass: #c69355;
    --frig-brass-deep: #8f5f2f;
    --frig-garnet: #7b3328;
    --frig-olive: #5d6b4f;
    --frig-line: rgba(68, 43, 26, 0.16);
    --frig-line-strong: rgba(68, 43, 26, 0.3);
    --frig-glow: rgba(246, 213, 160, 0.32);
    --frig-shadow: 0 28px 72px rgba(5, 3, 2, 0.34);
    --frig-shadow-soft: 0 16px 36px rgba(12, 8, 6, 0.16);
    --frig-board-shadow: 0 34px 90px rgba(0, 0, 0, 0.42);
    --frig-tape: rgba(243, 226, 190, 0.66);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--frig-ink);
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    background:
        radial-gradient(circle at 12% 0%, rgba(252, 224, 166, 0.22), transparent 18%),
        radial-gradient(circle at 82% 8%, rgba(238, 194, 122, 0.16), transparent 16%),
        linear-gradient(180deg, rgba(10, 8, 6, 0.12), rgba(10, 8, 6, 0.58)),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0, rgba(255, 255, 255, 0.02) 10%, transparent 10%, transparent 20%, rgba(255, 255, 255, 0.015) 20%, rgba(255, 255, 255, 0.015) 30%, transparent 30%, transparent 40%),
        linear-gradient(180deg, #2a1c16 0%, #17120f 45%, #100d0b 100%);
    background-size: auto, auto, auto, 340px 100%, auto;
    position: relative;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

body::before {
    background:
        linear-gradient(180deg, rgba(255, 246, 221, 0.03), transparent 22%),
        radial-gradient(circle at 50% 120%, rgba(0, 0, 0, 0.5), transparent 38%);
}

body::after {
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(70, 45, 26, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(70, 45, 26, 0.04) 1px, transparent 1px);
    background-size: 100% 6px, 6px 100%;
    mix-blend-mode: multiply;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.frig-shell {
    min-height: 100vh;
}

.frig-shell--embedded .frig-topbar {
    display: none;
}

.frig-home,
.frig-admin,
.frig-leaderboard-page,
.frig-game-page {
    width: min(1520px, calc(100% - 40px));
    margin: 0 auto;
    padding: 28px 0 42px;
    animation: frig-rise 0.7s ease both;
}

.frig-home__hero,
.frig-panel,
.frig-stage__sidebar,
.frig-section-card,
.frig-result,
.frig-minimal-panel {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(252, 245, 229, 0.98), rgba(234, 217, 188, 0.96));
    border: 1px solid var(--frig-line);
    box-shadow: var(--frig-shadow);
}

.frig-home__hero::before,
.frig-panel::before,
.frig-stage__sidebar::before,
.frig-section-card::before,
.frig-result::before,
.frig-minimal-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.34), transparent 28%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 38%);
    pointer-events: none;
}

.frig-home__hero::after,
.frig-panel::after,
.frig-stage__sidebar::after,
.frig-section-card::after,
.frig-minimal-panel::after {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(122, 90, 59, 0.1);
    border-radius: 20px;
    pointer-events: none;
}

.frig-kicker,
.frig-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(125, 88, 52, 0.08);
    border: 1px solid rgba(125, 88, 52, 0.14);
    color: var(--frig-ink-soft);
    font-family: "Courier New", monospace;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.frig-badge {
    background: rgba(186, 133, 74, 0.12);
    color: #5d3920;
}

.frig-topbar,
.frig-section-card__actions,
.frig-admin__toolbar,
.frig-actions,
.frig-admin__actions,
.frig-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.frig-topbar {
    margin-bottom: 20px;
}

.frig-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(95, 60, 32, 0.18);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 235, 191, 0.34), rgba(255, 235, 191, 0) 42%),
        linear-gradient(180deg, #8d5e34, #664022);
    color: #fff8ec;
    box-shadow:
        inset 0 1px 0 rgba(255, 247, 224, 0.36),
        0 10px 20px rgba(34, 19, 9, 0.18);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.frig-button:hover {
    transform: translateY(-2px);
    filter: saturate(1.04);
    box-shadow:
        inset 0 1px 0 rgba(255, 247, 224, 0.36),
        0 14px 28px rgba(34, 19, 9, 0.22);
}

.frig-button:active {
    transform: translateY(0);
}

.frig-button--ghost {
    background:
        linear-gradient(180deg, rgba(255, 252, 245, 0.9), rgba(239, 226, 202, 0.92));
    color: var(--frig-ink);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.68),
        0 8px 16px rgba(34, 19, 9, 0.08);
}

.frig-button.is-disabled,
.frig-button[aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.55;
    filter: grayscale(0.18);
}

.frig-panel {
    padding: 28px;
}

.frig-home__hero {
    padding: 28px 32px 24px;
    margin-bottom: 26px;
    background:
        linear-gradient(180deg, rgba(249, 239, 215, 0.98), rgba(225, 204, 168, 0.96));
    text-align: center;
}

.frig-home__hero::before {
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.3), transparent 25%),
        linear-gradient(180deg, rgba(148, 105, 56, 0.06), transparent 50%);
}

.frig-home__hero::after {
    inset: 18px;
    border-style: dashed;
}

.frig-home__hero h1,
.frig-stage__sidebar h1,
.frig-panel h1 {
    position: relative;
    z-index: 1;
    font-size: clamp(2.8rem, 5vw, 5.2rem);
    line-height: 0.94;
    color: #302016;
}

.frig-home__hero h1 {
    font-size: clamp(1.9rem, 3vw, 3.2rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
    white-space: nowrap;
    margin-inline: auto;
}

.frig-home__hero > p:not(.frig-kicker) {
    max-width: 980px;
    margin-top: 10px;
    margin-inline: auto;
    font-size: 0.92rem;
    line-height: 1.55;
}

.frig-progress-seals {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 14px auto 0;
}

.frig-progress-seal {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 26%, rgba(255, 250, 230, 0.9), rgba(218, 190, 139, 0.92));
    border: 1px solid rgba(112, 77, 42, 0.18);
    color: #7a5434;
    font-family: "Courier New", monospace;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.frig-progress-seal.is-complete {
    background:
        radial-gradient(circle at 34% 26%, rgba(255, 244, 205, 0.96), rgba(174, 117, 57, 0.98));
    color: #fff8ec;
}

.frig-progress-seal.is-current {
    outline: 2px solid rgba(123, 51, 40, 0.28);
    outline-offset: 3px;
}

.frig-home__hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
}

.frig-home__mission {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 340px);
    gap: 16px;
    align-items: stretch;
    margin-top: 12px;
    text-align: left;
}

.frig-home-story {
    position: relative;
    padding: 20px 18px 18px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 250, 239, 0.96), rgba(242, 227, 196, 0.94));
    border: 1px solid rgba(96, 61, 30, 0.12);
    box-shadow: var(--frig-shadow-soft);
}

.frig-section-card--focus {
    position: sticky;
    top: 22px;
    height: 100%;
    min-height: 100%;
    display: grid;
    grid-template-rows: minmax(240px, 1fr) auto;
}

.frig-home-story::before,
.frig-home-story::after {
    content: "";
    position: absolute;
    top: -8px;
    width: 52px;
    height: 14px;
    background: var(--frig-tape);
    border: 1px solid rgba(150, 118, 78, 0.24);
}

.frig-home-story::before {
    left: 22px;
    transform: rotate(-5deg);
}

.frig-home-story::after {
    right: 24px;
    transform: rotate(4deg);
}

.frig-home-story__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.frig-home-story__hint {
    color: var(--frig-ink-faint);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
}

.frig-home-story h2 {
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    color: #2f1f16;
    margin-bottom: 10px;
}

.frig-home-story__body {
    max-height: 408px;
    overflow: auto;
    padding-right: 8px;
    display: grid;
    gap: 10px;
}

.frig-home-story__body p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.75;
    color: #5f4634;
}

.frig-home__hero p,
.frig-panel p,
.frig-stage__sidebar p,
.frig-result p {
    position: relative;
    z-index: 1;
    line-height: 1.7;
    color: var(--frig-ink-soft);
}

.frig-home-register {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
    margin-top: 0;
    width: 100%;
    max-width: none;
    padding: 14px 16px 14px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 249, 238, 0.96), rgba(245, 230, 200, 0.92));
    border: 1px solid rgba(96, 61, 30, 0.12);
    box-shadow: var(--frig-shadow-soft);
}

.frig-home-register::before,
.frig-home-register::after {
    content: "";
    position: absolute;
    top: -10px;
    width: 52px;
    height: 18px;
    background: var(--frig-tape);
    border: 1px solid rgba(179, 147, 101, 0.3);
    transform: rotate(-4deg);
}

.frig-home-register::before {
    left: 28px;
}

.frig-home-register::after {
    right: 32px;
    transform: rotate(5deg);
}

.frig-home-register h2 {
    font-size: 1.1rem;
    color: #382419;
}

.frig-home-register p {
    font-size: 0.84rem;
    line-height: 1.48;
}

.frig-home-register > div:first-child {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 4px;
    align-items: center;
}

.frig-home-register > div:first-child .frig-kicker {
    grid-column: 1 / -1;
    margin-bottom: 2px;
}

.frig-home-register > div:first-child h2 {
    margin: 0;
    align-self: center;
}

.frig-home-register > div:first-child p:not(.frig-kicker) {
    margin: 0;
    align-self: center;
    font-size: 0.8rem;
    color: #6f5642;
}

.frig-player-register {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.frig-player-note {
    min-height: 1.4em;
    margin: 0;
    font-size: 0.8rem;
    color: #735740;
}

.frig-home .frig-kicker,
.frig-home .frig-badge {
    padding: 6px 11px;
    font-size: 0.68rem;
}

.frig-home > .frig-home__hero > .frig-kicker {
    margin-inline: auto;
}

.frig-home .frig-section-card__body h2 {
    font-size: clamp(1.35rem, 1.9vw, 1.8rem);
}

.frig-home .frig-section-card__body p {
    font-size: 0.9rem;
    line-height: 1.55;
}

.frig-home .frig-button {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.84rem;
}

.frig-home .frig-section-card__media {
    height: 220px;
}

.frig-home .frig-section-card__body {
    padding: 18px 18px 22px;
    min-height: 0;
    display: grid;
    align-content: start;
    grid-template-rows: auto auto 1fr auto;
    gap: 12px;
}

.frig-home .frig-section-card__actions {
    gap: 10px;
    margin-top: auto;
    align-self: end;
}

.frig-home .frig-section-card--focus .frig-section-card__media {
    height: 100%;
    min-height: 260px;
    margin-bottom: 0;
}

.frig-home .frig-section-card--focus .frig-section-card__body h2 {
    min-height: 2.5em;
}

.frig-home .frig-section-card--focus .frig-section-card__body p:not(.frig-badge) {
    min-height: 4.8em;
}

.frig-section-card {
    background:
        linear-gradient(180deg, rgba(250, 243, 226, 0.98), rgba(234, 217, 186, 0.96));
    transition: transform 0.26s ease, box-shadow 0.26s ease;
    cursor: pointer;
}

.frig-section-card:nth-child(3n + 1) {
    transform: rotate(-0.6deg);
}

.frig-section-card:nth-child(3n + 2) {
    transform: rotate(0.35deg);
}

.frig-section-card:nth-child(3n + 3) {
    transform: rotate(-0.2deg);
}

.frig-section-card:hover {
    transform: translateY(-5px) rotate(0deg);
    box-shadow: 0 36px 84px rgba(5, 3, 2, 0.36);
}

.frig-section-card.is-active {
    border-color: rgba(143, 95, 47, 0.32);
    box-shadow:
        0 36px 84px rgba(5, 3, 2, 0.32),
        0 0 0 2px rgba(198, 147, 85, 0.2);
}

.frig-section-card__media {
    position: relative;
    height: 250px;
    margin: 18px 18px 0;
    border-radius: 16px;
    background-color: #d8c3a3;
    background-size: cover;
    background-position: center;
    border: 10px solid #f6ead5;
    box-shadow:
        0 14px 30px rgba(18, 11, 7, 0.16),
        inset 0 0 0 1px rgba(105, 71, 41, 0.14);
}

.frig-section-card__media::before,
.frig-section-card__media::after {
    content: "";
    position: absolute;
    top: -10px;
    width: 56px;
    height: 16px;
    background: var(--frig-tape);
    border: 1px solid rgba(150, 118, 78, 0.28);
}

.frig-section-card__media::before {
    left: 18px;
    transform: rotate(-8deg);
}

.frig-section-card__media::after {
    right: 18px;
    transform: rotate(8deg);
}

.frig-section-card__media > * {
    position: relative;
    z-index: 1;
}

.frig-section-card__body {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
    padding: 24px 24px 28px;
}

.frig-section-card__body h2 {
    font-size: clamp(2rem, 2.6vw, 2.6rem);
    color: #2f1f16;
}

.frig-field {
    display: grid;
    gap: 8px;
}

.frig-field span {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--frig-ink-faint);
}

.frig-field input,
.frig-field textarea,
.frig-field select {
    width: 100%;
    padding: 10px 13px;
    border-radius: 15px;
    border: 1px solid rgba(94, 62, 35, 0.14);
    background:
        linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(244, 234, 214, 0.92));
    color: var(--frig-ink);
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.frig-field input:focus,
.frig-field textarea:focus,
.frig-field select:focus {
    outline: 2px solid rgba(198, 147, 85, 0.24);
    border-color: rgba(143, 95, 47, 0.34);
}

.frig-form-grid,
.frig-editor-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.frig-admin__layout,
.frig-previews {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
}

.frig-admin-note {
    margin: 0 0 16px;
    color: var(--frig-ink-soft);
}

.frig-inline-level-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.frig-inline-level-form select {
    min-width: 72px;
}

.frig-sortable-row {
    cursor: grab;
}

.frig-sortable-row.is-dragging {
    opacity: 0.48;
}

.frig-sortable-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.frig-drag-handle {
    border: 0;
    padding: 8px 10px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 251, 241, 0.96), rgba(233, 216, 188, 0.92));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
    color: var(--frig-ink-soft);
    font: inherit;
    letter-spacing: 0.12em;
    cursor: grab;
}

.frig-preview-card {
    padding: 20px;
    border-radius: 22px;
    border: 1px dashed rgba(103, 74, 46, 0.18);
    background:
        linear-gradient(180deg, rgba(255, 253, 247, 0.7), rgba(242, 233, 216, 0.5));
}

.frig-preview-card img,
.frig-pair-card__image {
    border-radius: 16px;
    object-fit: cover;
}

.frig-editor-shell {
    background:
        radial-gradient(circle at 18% 0%, rgba(251, 214, 145, 0.14), transparent 18%),
        radial-gradient(circle at 78% 8%, rgba(255, 232, 186, 0.08), transparent 14%),
        linear-gradient(180deg, rgba(8, 6, 5, 0.18), rgba(8, 6, 5, 0.72)),
        linear-gradient(180deg, #2a1c16 0%, #19120f 100%);
}

.frig-editor-page {
    max-width: 1660px;
}

.frig-editor-topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: end;
    margin-bottom: 20px;
}

.frig-editor-topbar h1 {
    font-size: clamp(2.2rem, 3vw, 3.7rem);
    color: #fff3db;
}

.frig-editor-topbar h1 span {
    color: rgba(255, 241, 215, 0.72);
    font-weight: 400;
}

.frig-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 420px);
    gap: 22px;
    align-items: start;
}

.frig-editor-main,
.frig-editor-side,
.frig-admin-section-form,
.frig-pair-editor {
    display: grid;
    gap: 22px;
}

.frig-minimal-panel {
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(251, 246, 233, 0.98), rgba(235, 219, 189, 0.96));
}

.frig-minimal-panel--sticky {
    position: sticky;
    top: 24px;
}

.frig-minimal-panel__head,
.frig-pair-editor__head,
.frig-upload-card__head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
    flex-wrap: wrap;
}

.frig-editor-note,
.frig-live-copy p,
.frig-batch-meta {
    margin: 0;
    color: var(--frig-ink-soft);
    line-height: 1.6;
}

.frig-editor-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.frig-editor-stat {
    min-width: 90px;
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 252, 244, 0.72);
    border: 1px solid rgba(103, 74, 46, 0.1);
}

.frig-editor-stat strong {
    font-size: 1.15rem;
    color: #3a2518;
}

.frig-editor-stat span {
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--frig-ink-faint);
}

.frig-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.frig-upload-card,
.frig-pair-card,
.frig-live-copy {
    position: relative;
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255, 252, 246, 0.94), rgba(241, 228, 201, 0.92));
    border: 1px solid rgba(103, 74, 46, 0.12);
    box-shadow: var(--frig-shadow-soft);
}

.frig-upload-card::before,
.frig-pair-card::before,
.frig-live-copy::before {
    content: "";
    position: absolute;
    top: -8px;
    right: 22px;
    width: 48px;
    height: 14px;
    background: var(--frig-tape);
    border: 1px solid rgba(150, 118, 78, 0.24);
    transform: rotate(4deg);
}

.frig-upload-card h3,
.frig-live-copy h3 {
    font-size: 1.18rem;
    color: #342217;
}

.frig-upload-preview,
.frig-live-scene {
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.frig-upload-preview {
    min-height: 210px;
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed rgba(103, 74, 46, 0.18);
    background-color: #ead7b5;
    display: grid;
    place-items: center;
    color: var(--frig-ink-soft);
    text-align: center;
}

.frig-upload-preview--wide {
    min-height: 220px;
}

.frig-front-preview-grid {
    display: grid;
    --front-grid-size: 4;
    grid-template-columns: repeat(var(--front-grid-size), minmax(0, 1fr));
    gap: 10px;
    width: min(100%, 460px);
    padding: 14px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(135, 92, 51, 0.96), rgba(116, 76, 38, 0.96));
    box-shadow:
        inset 0 0 0 1px rgba(255, 232, 190, 0.12),
        0 16px 32px rgba(27, 14, 8, 0.16);
}

.frig-front-preview-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    min-height: 44px;
    border-radius: 16px;
    padding: 6px;
    background:
        linear-gradient(180deg, rgba(255, 248, 234, 0.96), rgba(233, 215, 184, 0.94));
    box-shadow:
        0 10px 18px rgba(18, 11, 7, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.frig-front-preview-image {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #d7c09b;
}

.frig-batch-upload {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: end;
}

.frig-batch-upload__field {
    min-width: 0;
}

.frig-batch-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    gap: 8px;
}

.frig-batch-thumb {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    border: 3px solid rgba(255, 248, 234, 0.86);
    box-shadow: 0 8px 16px rgba(18, 11, 7, 0.12);
}

.frig-pair-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.frig-pair-grid--minimal {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.frig-pair-card--minimal {
    gap: 12px;
}

.frig-pair-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.frig-pair-visual {
    display: grid;
    gap: 0;
}

.frig-pair-card__image,
.frig-pair-placeholder {
    width: 100%;
    height: 180px;
}

.frig-pair-placeholder {
    display: grid;
    place-items: center;
    padding: 18px;
    border-radius: 16px;
    border: 1px dashed rgba(103, 74, 46, 0.18);
    background: rgba(236, 221, 193, 0.72);
    color: var(--frig-ink-soft);
    text-align: center;
}

.frig-live-scene {
    min-height: 300px;
    padding: 18px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(31, 19, 11, 0.24), rgba(31, 19, 11, 0.68)),
        linear-gradient(135deg, #d2b48a, #9d7048);
    box-shadow: inset 0 0 0 1px rgba(255, 240, 214, 0.12);
}

.frig-live-scene::before,
.frig-live-scene::after {
    content: "";
    position: absolute;
    top: 16px;
    width: 52px;
    height: 16px;
    background: var(--frig-tape);
    border: 1px solid rgba(150, 118, 78, 0.24);
}

.frig-live-scene::before {
    left: 28px;
    transform: rotate(-8deg);
}

.frig-live-scene::after {
    right: 28px;
    transform: rotate(7deg);
}

.frig-live-scene__overlay {
    min-height: 264px;
    display: flex;
    flex-direction: column;
    justify-content: end;
    gap: 8px;
    padding: 22px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(25, 17, 11, 0.04), rgba(25, 17, 11, 0.66));
    color: #fff6e6;
}

.frig-live-scene__overlay h3 {
    font-size: 2rem;
}

.frig-alert {
    margin: 14px 0;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid transparent;
    font-weight: 700;
}

.frig-alert--success {
    background: rgba(93, 107, 79, 0.14);
    color: var(--frig-olive);
    border-color: rgba(93, 107, 79, 0.24);
}

.frig-alert--error {
    background: rgba(123, 51, 40, 0.12);
    color: var(--frig-garnet);
    border-color: rgba(123, 51, 40, 0.18);
}

.frig-stage {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) minmax(210px, 250px);
    gap: 18px;
    align-items: start;
}

.frig-stage__sidebar {
    display: grid;
    gap: 12px;
    padding: 18px;
    width: 100%;
    max-width: 260px;
    justify-self: start;
}

.frig-game-page .frig-stage__sidebar h1,
.frig-game-page .frig-panel h1 {
    font-size: clamp(1.3rem, 1.95vw, 1.9rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.frig-game-page .frig-stage__sidebar p,
.frig-game-page .frig-panel p,
.frig-game-page .frig-player-note,
.frig-game-page .frig-button,
.frig-game-page .frig-leaderboard-mini li {
    font-size: 0.81rem;
}

.frig-game-page .frig-stage__subtitle {
    font-size: 0.84rem;
}

.frig-game-page .frig-stat span {
    font-size: 0.62rem;
}

.frig-game-page .frig-stat strong {
    font-size: 0.98rem;
}

.frig-game-page .frig-lore h2,
.frig-game-page .frig-result h2,
.frig-game-page .frig-panel h2 {
    font-size: 1rem;
}

.frig-game-page .frig-button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.78rem;
}

.frig-stage__subtitle {
    color: #4f3322;
    font-weight: 700;
}

.frig-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.frig-stat {
    padding: 10px 11px;
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 252, 246, 0.92), rgba(240, 228, 204, 0.9));
    border: 1px solid rgba(96, 61, 30, 0.1);
}

.frig-stat span {
    display: block;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--frig-ink-faint);
}

.frig-stat strong {
    color: #352217;
}

.frig-board-wrap {
    position: relative;
}

.frig-board-wrap::before {
    content: "";
    position: absolute;
    inset: 34px 28px auto;
    height: 90px;
    background: radial-gradient(circle, rgba(251, 213, 150, 0.18), transparent 65%);
    filter: blur(24px);
    pointer-events: none;
}

.frig-board {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--frig-board-size, 4), minmax(0, 1fr));
    gap: 16px;
    padding: 26px;
    border-radius: 28px;
    border: 18px solid #6b4528;
    background:
        linear-gradient(rgba(242, 226, 191, 0.14), rgba(242, 226, 191, 0.14)),
        radial-gradient(circle at 15% 22%, rgba(255, 255, 255, 0.08), transparent 14%),
        radial-gradient(circle at 74% 18%, rgba(255, 255, 255, 0.08), transparent 12%),
        linear-gradient(180deg, rgba(178, 127, 72, 0.92), rgba(129, 84, 46, 0.96));
    background-size: auto, auto, auto, cover;
    background-position: center;
    box-shadow:
        inset 0 0 0 1px rgba(255, 239, 214, 0.14),
        inset 0 0 0 12px rgba(109, 70, 38, 0.48),
        var(--frig-board-shadow);
}

.frig-board::before,
.frig-board::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffe1b1, #a16435 78%);
    box-shadow: 0 2px 0 rgba(53, 31, 15, 0.28);
}

.frig-board::before {
    top: 14px;
    left: 14px;
}

.frig-board::after {
    top: 14px;
    right: 14px;
}

.frig-card {
    position: relative;
    aspect-ratio: 1;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    perspective: 1200px;
    transition: transform 0.24s ease, filter 0.24s ease;
}

.frig-card:hover {
    transform: translateY(-3px);
    filter: brightness(1.02);
}

.frig-card__face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    backface-visibility: hidden;
    border-radius: 18px;
    transition: transform 0.48s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.28s ease, box-shadow 0.28s ease;
    box-shadow:
        0 16px 24px rgba(14, 9, 6, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.54);
}

.frig-card__face--front {
    padding: 7px;
    background:
        linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(229, 211, 180, 0.96));
    border: 1px solid rgba(91, 61, 35, 0.16);
}

.frig-card__face--front::before,
.frig-card__face--back::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 34px;
    height: 10px;
    transform: translateX(-50%) rotate(-3deg);
    background: var(--frig-tape);
    border: 1px solid rgba(150, 118, 78, 0.22);
    z-index: 2;
}

.frig-card__face--front::after {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 12px;
    background-image: inherit;
    background-size: inherit;
    background-position: inherit;
    background-repeat: inherit;
    box-shadow: inset 0 0 0 1px rgba(110, 80, 49, 0.12);
}

.frig-card__face--back {
    transform: rotateY(180deg);
    padding: 7px;
    background:
        linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(228, 210, 182, 0.96));
    border: 1px solid rgba(91, 61, 35, 0.16);
}

.frig-card.is-flipped .frig-card__face--front,
.frig-card.is-matched .frig-card__face--front {
    transform: rotateY(180deg);
}

.frig-card.is-flipped .frig-card__face--back,
.frig-card.is-matched .frig-card__face--back {
    transform: rotateY(0deg);
}

.frig-card.is-matched {
    cursor: default;
}

.frig-card.is-matched .frig-card__face--back {
    box-shadow:
        0 0 0 2px rgba(198, 147, 85, 0.4),
        0 20px 28px rgba(18, 11, 7, 0.2);
}

.frig-card.is-memory-found .frig-card__face--back {
    animation: frig-memory-found 0.48s ease both;
}

.frig-card.is-cleared {
    opacity: 0;
    transform: scale(0.74);
    pointer-events: none;
}

.frig-card.is-cleared .frig-card__face {
    box-shadow: none;
}

.frig-card__art {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(110, 80, 49, 0.12);
}

.frig-lore,
.frig-result {
    padding: 14px 15px;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255, 251, 242, 0.95), rgba(239, 226, 199, 0.92));
    border: 1px solid rgba(96, 61, 30, 0.12);
}

.frig-lore h2,
.frig-result h2 {
    margin-bottom: 8px;
    color: #372317;
}

.frig-lore__bonus {
    margin-top: 12px;
    color: #5a3a24;
    font-weight: 700;
}

.frig-result {
    display: none;
    margin-top: 18px;
}

.frig-result.is-visible {
    display: block;
    animation: frig-rise 0.45s ease both;
}

.frig-result__insights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 18px;
}

.frig-insight-chip {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(198, 147, 85, 0.1);
    border: 1px solid rgba(96, 61, 30, 0.12);
    color: #5b3a24;
    font-weight: 700;
}

.frig-result__table-wrap {
    margin: 8px 0 18px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 252, 246, 0.76);
    border: 1px solid rgba(96, 61, 30, 0.1);
}

.frig-result-table,
.frig-table {
    width: 100%;
    border-collapse: collapse;
}

.frig-result-table th,
.frig-result-table td,
.frig-table th,
.frig-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(96, 61, 30, 0.1);
    text-align: left;
}

.frig-result-table th,
.frig-table th {
    color: var(--frig-ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
}

.frig-result-table__lead,
.frig-result-table__rank {
    margin: 0 0 12px;
}

.frig-toast-stack {
    position: absolute;
    top: 18px;
    left: 50%;
    z-index: 8;
    display: grid;
    gap: 8px;
    width: min(560px, calc(100% - 32px));
    pointer-events: none;
    transform: translateX(-50%);
}

.frig-toast {
    padding: 10px 14px;
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 251, 242, 0.96), rgba(238, 222, 190, 0.94));
    border: 1px solid rgba(96, 61, 30, 0.14);
    box-shadow: 0 12px 28px rgba(15, 9, 6, 0.18);
    color: #4f3322;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    animation: frig-toast-in 0.28s ease both;
}

.frig-toast--success {
    border-color: rgba(93, 107, 79, 0.28);
    color: #425236;
}

.frig-toast--danger {
    border-color: rgba(123, 51, 40, 0.24);
    color: #7b3328;
}

.frig-toast.is-leaving {
    animation: frig-toast-out 0.42s ease both;
}

.frig-coach-list {
    margin: 0 0 14px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(242, 228, 199, 0.76);
    border: 1px solid rgba(96, 61, 30, 0.1);
}

.frig-coach-list h3 {
    margin-bottom: 8px;
    color: #352217;
    font-size: 1rem;
}

.frig-coach-list p {
    margin: 7px 0 0;
    color: #5f4634;
    line-height: 1.55;
}

.frig-modal[hidden] {
    display: none;
}

.frig-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 20px;
}

.frig-modal__backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(15, 10, 7, 0.34), rgba(15, 10, 7, 0.76)),
        rgba(15, 10, 7, 0.38);
    backdrop-filter: blur(2px);
}

.frig-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100vw - 40px));
    min-height: min(88vh, 920px);
    max-height: min(92vh, 980px);
    overflow: auto;
    padding: 30px 30px 26px;
    border-radius: 34px;
    background:
        linear-gradient(180deg, rgba(251, 245, 230, 0.98), rgba(234, 217, 186, 0.96));
    border: 1px solid rgba(96, 61, 30, 0.16);
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.frig-modal__dialog::before,
.frig-modal__dialog::after {
    content: "";
    position: absolute;
    top: -10px;
    width: 62px;
    height: 16px;
    background: var(--frig-tape);
    border: 1px solid rgba(150, 118, 78, 0.24);
}

.frig-modal__dialog::before {
    left: 32px;
    transform: rotate(-6deg);
}

.frig-modal__dialog::after {
    right: 32px;
    transform: rotate(5deg);
}

.frig-modal__title {
    font-size: clamp(2.4rem, 6vw, 4.6rem);
    line-height: 0.95;
    color: #2d1d15;
    margin: 8px 0 4px;
}

.frig-modal__subtitle {
    margin: 0 0 14px;
    font-size: clamp(1rem, 2vw, 1.32rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #7a5434;
}

.frig-modal__text {
    max-width: 680px;
    margin: 0 auto 18px;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--frig-ink-soft);
}

.frig-modal__insights {
    justify-content: center;
    margin-bottom: 18px;
}

.frig-modal__table-wrap {
    margin: 0 auto 18px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 252, 246, 0.78);
    border: 1px solid rgba(96, 61, 30, 0.1);
    text-align: left;
}

.frig-modal__actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 760px) {
    .frig-modal {
        padding: 12px;
    }

    .frig-modal__dialog {
        width: calc(100vw - 24px);
        min-height: calc(100vh - 24px);
        max-height: calc(100vh - 24px);
        padding: 24px 18px 20px;
        border-radius: 24px;
    }
}

.frig-leaderboard-mini {
    display: grid;
    gap: 12px;
    padding-left: 0;
    margin: 0;
    list-style: none;
}

.frig-leaderboard-mini li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 15px;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255, 253, 247, 0.9), rgba(240, 228, 204, 0.88));
    border: 1px solid rgba(96, 61, 30, 0.08);
}

.frig-table-wrap {
    overflow-x: auto;
}

@keyframes frig-rise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes frig-toast-in {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes frig-toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
}

@keyframes frig-memory-found {
    0% {
        filter: brightness(1);
        transform: rotateY(0deg) scale(1);
    }

    45% {
        filter: brightness(1.25);
        transform: rotateY(0deg) scale(1.04);
    }

    100% {
        filter: brightness(1);
        transform: rotateY(0deg) scale(1);
    }
}

@media (max-width: 1180px) {
    .frig-stage,
    .frig-editor-layout {
        grid-template-columns: 1fr;
    }

    .frig-minimal-panel--sticky {
        position: static;
    }

    .frig-home__mission {
        grid-template-columns: 1fr;
    }

    .frig-home__hero-grid {
        grid-template-columns: 1fr;
    }

    .frig-section-card--focus {
        position: static;
    }
}

@media (max-width: 860px) {
    .frig-admin__layout,
    .frig-previews,
    .frig-upload-grid,
    .frig-pair-grid,
    .frig-pair-grid--minimal {
        grid-template-columns: 1fr;
    }

    .frig-home,
    .frig-admin,
    .frig-leaderboard-page,
    .frig-game-page {
        width: min(100%, calc(100% - 20px));
        padding: 16px 0 28px;
    }

    .frig-home__hero,
    .frig-panel,
    .frig-stage__sidebar,
    .frig-minimal-panel {
        padding: 22px;
    }

    .frig-player-register,
    .frig-batch-upload,
    .frig-editor-topbar {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .frig-home__hero h1,
    .frig-stage__sidebar h1,
    .frig-panel h1 {
        font-size: clamp(2.1rem, 12vw, 3.6rem);
    }

    .frig-home__hero h1 {
        font-size: clamp(1.45rem, 7vw, 2.2rem);
        white-space: normal;
    }

    .frig-home-story__head {
        flex-direction: column;
        align-items: start;
    }

    .frig-home-register > div:first-child {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .frig-topbar,
    .frig-section-card__actions,
    .frig-admin__toolbar,
    .frig-actions,
    .frig-editor-actions {
        flex-direction: column;
    }

    .frig-home__hero,
    .frig-panel,
    .frig-stage__sidebar,
    .frig-minimal-panel {
        border-radius: 22px;
    }

    .frig-home__hero::after,
    .frig-panel::after,
    .frig-stage__sidebar::after,
    .frig-section-card::after,
    .frig-minimal-panel::after {
        inset: 12px;
    }

    .frig-section-card {
        transform: none;
    }

    .frig-section-card__media {
        height: 210px;
        margin: 16px 16px 0;
    }

    .frig-board {
        gap: 9px;
        padding: 14px;
        border-width: 10px;
        border-radius: 24px;
    }

    .frig-card__face {
        border-radius: 14px;
    }

    .frig-front-preview-grid {
        width: 100%;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

}
