:root {
    --bg: #eff2f8;
    --bg-soft: #f8fafc;
    --surface: #ffffff;
    --surface-soft: #f9fbff;
    --text: #162033;
    --muted: #5c6b83;
    --line: #d4ddea;
    --accent: #d55b22;
    --accent-strong: #b34716;
    --shadow: 0 14px 38px rgba(22, 32, 51, 0.1);
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    color: var(--text);
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", sans-serif;
    line-height: 1.55;
    background:
        radial-gradient(circle at 9% 0%, #fff7d6 0%, transparent 34%),
        radial-gradient(circle at 100% 20%, #e8f0ff 0%, transparent 40%),
        linear-gradient(180deg, var(--bg-soft), var(--bg));
}

h1,
h2,
h3,
.brand {
    margin-top: 0;
    font-family: "Book Antiqua", "Palatino Linotype", Palatino, serif;
    letter-spacing: 0.02em;
}

a {
    color: inherit;
}

.container {
    width: min(1040px, 92%);
    margin: 0 auto;
}

.site-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(246, 250, 255, 0.82);
    backdrop-filter: blur(7px);
    position: sticky;
    top: 0;
    z-index: 5;
    transition: transform 0.3s ease;
}

.site-header.hidden {
    transform: translateY(-100%);
}

.nav-wrap {
    display: grid;
    gap: 0.55rem;
    justify-items: center;
    padding: 0.85rem 0 1rem;
}

.brand {
    text-decoration: none;
    font-size: clamp(1.45rem, 2.6vw, 2rem);
    font-weight: 700;
}

.site-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.site-nav {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: center;
}

.site-nav a {
    text-decoration: none;
    font-weight: 700;
    color: var(--muted);
    padding: 0.38rem 0.78rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--text);
    border-color: var(--line);
    background: #ffffffc9;
}

main {
    padding: 2rem 0 3.3rem;
}

.hero {
    text-align: center;
    padding: 2.15rem 1.2rem;
    border-radius: var(--radius-lg);
    border: 1px solid #ffffff;
    background: linear-gradient(130deg, #ffffffee, #fff5e7ee);
    box-shadow: var(--shadow);
    animation: rise-in 0.5s ease-out both;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-strong);
    font-size: 0.74rem;
    font-weight: 700;
}

.hero h1 {
    margin: 0.45rem 0 0.4rem;
    font-size: clamp(2.1rem, 5.1vw, 3.2rem);
}

.hero p {
    margin: 0;
    color: var(--muted);
    max-width: 760px;
    margin-inline: auto;
}

.section-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.3rem;
}

.section-card {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    min-height: 250px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid #ffffff;
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: fade-up 0.5s ease both;
}

.section-card img {
    width: 100%;
    height: 100%;
    min-height: 250px;
    object-fit: cover;
    display: block;
}

.section-card.section-4x4 img {
    object-fit: contain;
    padding: 0.35rem;
}

.section-card.section-blindfolded-solving img {
    transform: scale(1.12);
    transform-origin: center;
}

.card-body {
    padding: 1rem 1.1rem;
}

.card-body h2,
.card-body h3 {
    margin: 0;
}

.card-body h2 a {
    text-decoration: none;
    color: var(--text);
}

.card-body h2 a:hover {
    text-decoration: underline;
}

.card-body p {
    margin: 0.5rem 0 0;
    color: var(--muted);
}

.card-link {
    display: inline-flex;
    margin-top: 0.85rem;
    color: var(--accent-strong);
    font-weight: 700;
    text-decoration: none;
}

.card-link:hover {
    text-decoration: underline;
}

.section-block {
    margin-top: 1.35rem;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
}

.section-block.compact {
    margin-top: 1.1rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.section-head h2 {
    margin: 0;
}

.section-head a {
    color: var(--accent-strong);
    font-weight: 700;
    text-decoration: none;
}

.section-head a:hover {
    text-decoration: underline;
}

.muted-copy {
    margin: 0.45rem 0 0;
    color: var(--muted);
}

.page-intro {
    margin-bottom: 1rem;
}

.page-intro h1 {
    margin: 0.3rem 0 0;
}

.page-intro p {
    color: var(--muted);
    margin: 0.35rem 0 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.cube-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid #ffffff;
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: fade-up 0.45s ease both;
}

.cube-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.meta-row {
    margin-top: 0.8rem;
    display: flex;
    justify-content: space-between;
    gap: 0.55rem;
    align-items: center;
}

.tag {
    background: #ffe8d9;
    color: var(--accent-strong);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.23rem 0.58rem;
}

.price {
    font-weight: 700;
}

.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.story-grid article,
.contact-box,
.detail-box {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid #ffffff;
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
}

.story-grid p,
.contact-box p,
.detail-box p {
    margin: 0.42rem 0 0;
    color: var(--muted);
}

.section-layout {
    display: grid;
    grid-template-columns: minmax(220px, 330px) 1fr;
    gap: 1rem;
    align-items: start;
}

.section-layout img {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid #ffffff;
    box-shadow: var(--shadow);
}

.detail-box h2 {
    margin: 0;
}

.bullet-list {
    margin: 0.75rem 0 0;
    padding-left: 1.15rem;
    color: var(--text);
}

.bullet-list li {
    margin-bottom: 0.3rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    margin-top: 0.9rem;
}

.btn-solid {
    background: var(--accent);
    color: #ffffff;
}

.btn-solid:hover {
    background: var(--accent-strong);
}

.btn-ghost {
    background: #ffffff;
    border: 1px solid var(--line);
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--surface-soft);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--surface-soft);
}

.timer-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1rem;
}

.record-flash {
    position: fixed;
    left: 50%;
    top: 92px;
    transform: translateX(-50%) scale(0.85);
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    background: linear-gradient(120deg, #d55b22, #ff8b4e);
    color: #ffffff;
    font-weight: 700;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(213, 91, 34, 0.35);
}

.record-flash.show {
    animation: record-pop 1.8s ease-out forwards;
}

.record-fireworks {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 29;
    overflow: hidden;
}

.firework-particle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
    animation: firework-burst 1600ms ease-out forwards;
    animation-delay: var(--delay, 0ms);
}

.timer-main {
    display: grid;
    gap: 0.8rem;
}

.timer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.timer-controls label {
    font-weight: 700;
    font-size: 1.05rem;
}

.timer-controls select {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    background: #ffffff;
    color: var(--text);
    font-size: 1rem;
    min-width: 95px;
}

.timer-controls .btn {
    margin-top: 0;
    padding: 0.62rem 1rem;
    font-size: 0.98rem;
}

.scramble-text {
    margin: 0;
    min-height: 2.8rem;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.01em;
}


.inspection-display {
    margin: 0;
    color: var(--accent-strong);
    font-weight: 700;
    font-size: 1.18rem;
}

.timer-display {
    margin: 0;
    font-family: "Book Antiqua", "Palatino Linotype", Palatino, serif;
    font-size: clamp(3rem, 12vw, 6.6rem);
    line-height: 1;
}

.timer-primary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.timer-display.inspection-mode {
    font-size: clamp(4rem, 17vw, 9rem);
    color: var(--accent-strong);
}

.timer-help {
    margin: 0;
    color: var(--muted);
}

.timer-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
}

.stat-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
}

.stat-label {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.stat-value {
    margin: 0.2rem 0 0;
    font-size: 1.3rem;
    font-weight: 700;
}

#current-ao5-value,
#current-ao12-value,
#current-ao100-value,
#best-ao5-value,
#best-ao12-value,
#best-ao100-value {
    cursor: pointer;
    color: var(--accent-strong);
}

#current-ao5-value:hover,
#current-ao12-value:hover,
#current-ao100-value:hover,
#best-ao5-value:hover,
#best-ao12-value:hover,
#best-ao100-value:hover {
    text-decoration: underline;
}

.timer-side h2,
.chart-box h2 {
    margin: 0;
}

.results-list {
    margin: 0.8rem 0 0;
    padding: 0;
    list-style: none;
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
}

.result-row,
.result-empty {
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--line);
}

.result-row {
    cursor: pointer;
}

.result-row:hover {
    background: var(--surface-soft);
}

.result-row.selected {
    background: #fff2e7;
    border-left: 4px solid var(--accent);
    padding-left: calc(0.7rem - 4px);
}

.result-row:last-child,
.result-empty:last-child {
    border-bottom: 0;
}

.chart-box {
    margin-top: 1rem;
}

.solve-info-box {
    margin-top: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    background: var(--surface-soft);
}

.solve-info-box h3 {
    margin: 0;
    font-size: 0.98rem;
}

.solve-info-time,
.solve-info-scramble {
    margin: 0.45rem 0 0;
    color: var(--text);
}

.solve-info-scramble {
    color: var(--muted);
    word-break: break-word;
}

.solve-penalty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.clock-penalty-actions {
    margin-top: 0;
}

.solve-penalty-actions .btn {
    margin-top: 0;
}

.average-info-times {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.55rem;
}

.avg-time-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 700;
    padding: 0.35rem 0.62rem;
    cursor: pointer;
}

.avg-time-chip:hover {
    background: var(--surface-soft);
}

.alg-trainer-box {
    margin-bottom: 1rem;
}

.alg-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.alg-header-row h2 {
    margin: 0;
}

.alg-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.alg-actions .btn {
    margin-top: 0;
}

.alg-sequence {
    margin: 0.75rem 0 0;
    font-family: "Courier New", monospace;
    font-size: 1.08rem;
    line-height: 1.5;
    background: #f4f7fc;
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 0.7rem 0.75rem;
}

.alg-case-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.alg-case-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text);
    padding: 0.38rem 0.7rem;
    font-weight: 700;
    cursor: pointer;
}

.alg-case-chip:hover,
.alg-case-chip.active {
    background: var(--surface-soft);
    border-color: #b8c7de;
}

.timer-instructions {
    margin-top: 1rem;
}

.chart-box canvas {
    margin-top: 0.75rem;
    height: 320px !important;
    width: 100% !important;
}

.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(252, 253, 255, 0.82);
}

.footer-wrap {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: var(--muted);
    padding: 0.95rem 0 1.2rem;
}

@media (max-width: 900px) {
    .timer-layout,
    .section-list,
    .section-card,
    .section-layout {
        grid-template-columns: 1fr;
    }

    .timer-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-card img {
        min-height: 205px;
    }
}

@media (max-width: 640px) {
    .timer-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hero {
        padding: 1.6rem 1rem;
    }

    .site-nav {
        width: 100%;
    }

    .site-nav a {
        flex: 1;
        text-align: center;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-wrap {
        flex-direction: column;
    }
}

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

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

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

@keyframes record-pop {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.85);
    }

    18% {
        opacity: 1;
        transform: translateX(-50%) scale(1.06);
    }

    78% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.9);
    }
}

@keyframes firework-burst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(0.6);
    }

    100% {
        opacity: 0;
        transform: translate(var(--dx), var(--dy)) scale(1);
    }
}

.instruction-note {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95em;
    margin-top: 12px;
    display: inline-block;
}

.scramble-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.scramble-display {
    background: #f4f7fc;
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 1.2rem 1rem;
    margin-bottom: 1rem;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scramble-display span {
    font-family: "Courier New", monospace;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    word-break: break-word;
}

.instruction-box {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.instruction-box p {
    margin: 0;
    color: #856404;
}

.f2l-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.f2l-controls label {
    font-weight: 700;
    font-size: 1rem;
}

.f2l-controls select {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    color: var(--text);
    font-size: 1rem;
}

.f2l-scramble-display {
    background: #f4f7fc;
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
}

.f2l-scramble-line {
    font-family: "Courier New", monospace;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.6;
}

.language-switcher {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    padding: 0.5rem 0;
}

.language-switcher .lang-link,
.language-switcher .lang-current {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
}

.language-switcher .lang-link {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--muted);
    transition: all 0.2s;
}

.language-switcher .lang-link:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.language-switcher .lang-current {
    background: var(--accent);
    color: white;
    font-weight: 600;
}
