:root {
    --v103-gold: #d9b766;
    --v103-gold-bright: #ffe4a1;
    --v103-ivory: #efe4c6;
    --v103-muted: #a99d82;
    --v103-red: #8d1828;
    --v103-ink: #07090a;
}

body.v103-rulebook-open {
    overflow: hidden !important;
}

#v103-rulebook[hidden] {
    display: none !important;
}

#v103-rulebook {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: grid;
    place-items: center;
    padding: clamp(8px, 1.6vw, 24px);
    color: var(--v103-ivory);
    background:
        radial-gradient(circle at 16% 18%, rgba(146, 25, 42, .28), transparent 34%),
        radial-gradient(circle at 82% 86%, rgba(184, 137, 47, .15), transparent 31%),
        linear-gradient(135deg, rgba(3, 5, 6, .99), rgba(15, 10, 10, .99));
    font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", Georgia, serif;
    isolation: isolate;
}

#v103-rulebook::before,
#v103-rulebook::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

#v103-rulebook::before {
    inset: 11px;
    border: 1px solid rgba(217, 183, 102, .27);
    box-shadow: inset 0 0 70px rgba(0, 0, 0, .86);
}

#v103-rulebook::after {
    inset: 0;
    z-index: -1;
    opacity: .2;
    background-image:
        linear-gradient(90deg, transparent 49.8%, rgba(217, 183, 102, .25) 50%, transparent 50.2%),
        linear-gradient(0deg, transparent 49.8%, rgba(217, 183, 102, .16) 50%, transparent 50.2%);
    background-size: 94px 94px;
    mask-image: radial-gradient(circle, #000, transparent 78%);
}

.v103-rulebook-shell {
    position: relative;
    width: min(1500px, 100%);
    height: min(920px, 100%);
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid rgba(217, 183, 102, .58);
    background: linear-gradient(145deg, rgba(19, 18, 16, .985), rgba(5, 7, 8, .99));
    box-shadow: 0 30px 90px rgba(0, 0, 0, .82), inset 0 1px 0 rgba(255, 242, 196, .08);
}

.v103-rulebook-header {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(15px, 2.2vw, 34px);
    border-bottom: 1px solid rgba(217, 183, 102, .28);
    background: linear-gradient(90deg, rgba(104, 16, 30, .38), transparent 47%);
}

.v103-rulebook-brand {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.v103-rulebook-seal {
    width: 46px;
    height: 58px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 224, 150, .65);
    color: var(--v103-gold-bright);
    background: linear-gradient(145deg, #7c1425, #26070d 72%);
    font-size: 25px;
    box-shadow: 0 0 22px rgba(144, 20, 38, .36), inset 0 0 0 4px rgba(0, 0, 0, .25);
}

.v103-rulebook-kicker,
.v103-page-kicker,
.v103-visual-number {
    color: var(--v103-gold);
    font: 700 10px/1.2 "Courier New", monospace;
    letter-spacing: .2em;
}

#v103-rulebook-title {
    margin: 4px 0 0;
    color: #fff0c4;
    font-size: clamp(19px, 2.1vw, 30px);
    line-height: 1.1;
    letter-spacing: .08em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .75);
}

.v103-rulebook-close,
.v103-nav-button,
.v103-chapter-button {
    appearance: none;
    border: 1px solid rgba(217, 183, 102, .42);
    color: #dfd2ae;
    background: rgba(10, 11, 11, .88);
    cursor: pointer;
    font: inherit;
}

.v103-rulebook-close {
    min-height: 43px;
    padding: 8px 16px;
    letter-spacing: .08em;
}

.v103-rulebook-close:hover,
.v103-rulebook-close:focus-visible,
.v103-nav-button:hover:not(:disabled),
.v103-nav-button:focus-visible,
.v103-chapter-button:hover,
.v103-chapter-button:focus-visible {
    outline: none;
    border-color: var(--v103-gold-bright);
    color: #fff2ca;
    box-shadow: 0 0 0 2px rgba(217, 183, 102, .18);
}

.v103-chapters {
    display: grid;
    grid-template-columns: repeat(6, minmax(126px, 1fr));
    gap: 1px;
    overflow-x: auto;
    scrollbar-width: thin;
    border-bottom: 1px solid rgba(217, 183, 102, .24);
    background: rgba(217, 183, 102, .14);
}

.v103-chapter-button {
    position: relative;
    min-height: 54px;
    padding: 9px 11px 8px 42px;
    border: 0;
    text-align: left;
    white-space: nowrap;
}

.v103-chapter-button::before {
    content: attr(data-number);
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(217, 183, 102, .52);
    font: 700 10px/1 "Courier New", monospace;
}

.v103-chapter-button[aria-current="page"] {
    color: #fff0bd;
    background: linear-gradient(110deg, rgba(127, 20, 36, .95), rgba(38, 8, 13, .96));
    box-shadow: inset 0 -3px 0 var(--v103-gold);
}

.v103-rulebook-stage {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(330px, .9fr);
    overflow: hidden;
}

.v103-visual {
    position: relative;
    min-width: 0;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    border-right: 1px solid rgba(217, 183, 102, .25);
    background: #030405;
}

.v103-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent 68%, rgba(4, 6, 7, .82)),
        linear-gradient(0deg, rgba(4, 6, 7, .8), transparent 23% 80%, rgba(4, 6, 7, .34));
    box-shadow: inset 0 0 58px rgba(0, 0, 0, .72);
}

#v103-rulebook-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity .3s ease, transform .7s ease;
}

#v103-rulebook-image.v103-loaded {
    opacity: .92;
    transform: scale(1);
}

.v103-visual-label {
    position: absolute;
    z-index: 2;
    left: clamp(14px, 2vw, 28px);
    bottom: clamp(13px, 2vw, 25px);
    max-width: calc(100% - 28px);
    padding: 10px 13px;
    border-left: 3px solid var(--v103-gold);
    background: linear-gradient(90deg, rgba(3, 5, 6, .86), rgba(3, 5, 6, .2));
    text-shadow: 0 2px 8px #000;
}

#v103-visual-caption {
    display: block;
    margin-top: 4px;
    color: #f2e6c8;
    font-size: clamp(12px, 1.05vw, 15px);
    line-height: 1.55;
}

.v103-rulebook-copy {
    min-height: 0;
    overflow-y: auto;
    padding: clamp(18px, 2.4vw, 35px);
    scrollbar-color: rgba(217, 183, 102, .46) rgba(0, 0, 0, .3);
}

#v103-page-title {
    margin: 8px 0 10px;
    color: #fff0c4;
    font-size: clamp(24px, 3vw, 42px);
    line-height: 1.2;
    letter-spacing: .06em;
}

#v103-page-lead {
    margin: 0 0 18px;
    color: #cfc2a3;
    font-size: clamp(12px, 1.15vw, 15px);
    line-height: 1.75;
}

.v103-rulebook-body {
    display: grid;
    gap: 10px;
}

.v103-rule,
.v103-special-rule {
    position: relative;
    padding: 11px 12px 11px 37px;
    border: 1px solid rgba(217, 183, 102, .18);
    background: linear-gradient(120deg, rgba(217, 183, 102, .08), rgba(255, 255, 255, .015));
    color: #ded3b7;
    font-size: clamp(11px, 1vw, 14px);
    line-height: 1.72;
}

.v103-rule::before {
    content: attr(data-step);
    position: absolute;
    left: 11px;
    top: 12px;
    color: var(--v103-gold-bright);
    font: 700 11px/1.55 "Courier New", monospace;
}

.v103-rule strong,
.v103-special-rule strong {
    color: #fff0c4;
}

.v103-card-order,
.v103-key-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.v103-card-order span,
.v103-key {
    min-width: 28px;
    padding: 5px 7px;
    border: 1px solid rgba(217, 183, 102, .35);
    color: #f4e8c7;
    background: rgba(3, 5, 6, .7);
    text-align: center;
    font: 700 11px/1.2 "Courier New", monospace;
}

.v103-card-order i {
    color: var(--v103-gold);
    font-style: normal;
}

.v103-note {
    padding: 10px 12px;
    border-left: 3px solid #a82539;
    color: #cbbf9f;
    background: rgba(108, 16, 30, .15);
    font-size: clamp(10px, .95vw, 13px);
    line-height: 1.65;
}

.v103-special-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.v103-special-rule {
    padding-left: 12px;
}

.v103-special-rule em {
    display: inline-grid;
    place-items: center;
    min-width: 27px;
    height: 27px;
    margin-right: 7px;
    border: 1px solid rgba(217, 183, 102, .4);
    color: var(--v103-gold-bright);
    background: rgba(110, 17, 31, .35);
    font-style: normal;
}

.v103-rulebook-footer {
    min-height: 62px;
    display: grid;
    grid-template-columns: minmax(112px, auto) 1fr minmax(112px, auto);
    align-items: center;
    gap: 15px;
    padding: 9px clamp(14px, 2.2vw, 34px);
    border-top: 1px solid rgba(217, 183, 102, .26);
    background: rgba(4, 6, 7, .96);
}

.v103-nav-button {
    min-height: 42px;
    padding: 8px 16px;
    letter-spacing: .08em;
}

.v103-nav-button:disabled {
    opacity: .32;
    cursor: default;
}

.v103-progress {
    display: grid;
    justify-items: center;
    gap: 6px;
    min-width: 0;
}

#v103-page-count {
    color: #b7aa8e;
    font: 700 10px/1 "Courier New", monospace;
    letter-spacing: .18em;
}

.v103-progress-track {
    width: min(330px, 100%);
    height: 3px;
    overflow: hidden;
    background: rgba(217, 183, 102, .18);
}

#v103-progress-fill {
    width: 16.6667%;
    height: 100%;
    background: linear-gradient(90deg, #86172a, #f0cb70);
    transition: width .28s ease;
}

@media (max-width: 900px) {
    #v103-rulebook { padding: 0; }
    #v103-rulebook::before { display: none; }
    .v103-rulebook-shell { width: 100%; height: 100%; border: 0; }
    .v103-rulebook-stage { grid-template-columns: 1fr; grid-template-rows: minmax(210px, 42vh) minmax(0, 1fr); overflow: hidden; }
    .v103-visual { border-right: 0; border-bottom: 1px solid rgba(217, 183, 102, .25); }
    .v103-visual::after { background: linear-gradient(0deg, rgba(4, 6, 7, .86), transparent 37% 80%, rgba(4, 6, 7, .2)); }
    .v103-chapters { grid-template-columns: repeat(6, minmax(132px, 1fr)); }
    .v103-rulebook-copy { padding: 18px 17px 28px; }
}

@media (max-width: 560px) {
    .v103-rulebook-header { min-height: 62px; padding: 9px 11px; }
    .v103-rulebook-seal { width: 36px; height: 43px; font-size: 20px; }
    .v103-rulebook-kicker { font-size: 7px; }
    #v103-rulebook-title { font-size: 17px; }
    .v103-rulebook-close { min-height: 38px; padding: 7px 10px; font-size: 11px; }
    .v103-chapter-button { min-height: 47px; padding-block: 7px; font-size: 11px; }
    .v103-rulebook-stage { grid-template-rows: minmax(180px, 34vh) minmax(0, 1fr); }
    #v103-page-title { font-size: 24px; }
    .v103-rulebook-footer { min-height: 56px; grid-template-columns: 92px 1fr 92px; gap: 7px; padding: 7px 9px; }
    .v103-nav-button { min-height: 39px; padding: 7px 8px; font-size: 11px; }
    .v103-progress-track { width: 100%; }
}

@media (max-height: 650px) and (min-width: 901px) {
    .v103-rulebook-header { min-height: 58px; padding-block: 8px; }
    .v103-rulebook-seal { width: 37px; height: 43px; }
    .v103-chapter-button { min-height: 45px; }
    .v103-rulebook-footer { min-height: 52px; }
    .v103-rulebook-copy { padding-block: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    #v103-rulebook *,
    #v103-rulebook *::before,
    #v103-rulebook *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
