@font-face {
    font-family: 'Quicksand';
    src: url('quicksand01.woff2') format('woff2');
    font-weight: 300 700;
    font-display: swap;
}
:root {
    --rt-navy: #023E7C;
    --rt-steel: #4E8FB5;
    --rt-grid-line: #023E7C;
    --rt-solution-cell: #dce9f3;
    --rt-word-highlight: rgba(78, 143, 181, 0.22);
    --rt-current-highlight: rgba(78, 143, 181, 0.55);
    --rt-bg-start: #dcebf4;
    --rt-bg-mid: #eef5f9;
    --rt-bg-end: #f8fbfc;
    --rt-surface: #f7f9fc;
    --rt-hover: #e8f1fb;
    --rt-active: #deeaf9;
}
body {
    padding: 0px;
    background-color: transparent;
    font-family: 'Quicksand', sans-serif;
    font-size: 12px;
}
h1 {
    text-align: center;
    color: var(--rt-navy);
    font-weight: 500;
    font-size: 32px;
    letter-spacing: 0.5px;
}
strong {
    color: var(--rt-navy);
}
#page-wrapper {
    margin: 0 auto;
    padding: 0px 0px;
}
#main-layout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    padding: 20px;
}
#puzzle-wrapper {
    width: 100%;
    min-width: 0;
    max-width: 1600px;
    margin-right: auto;
    position: relative;
}
#puzzle-background {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(160deg, var(--rt-bg-start) 0%, var(--rt-bg-mid) 45%, var(--rt-bg-end) 100%);
    z-index: 0;
}

/* Decorative bubbles, sized relative to the puzzle width */
#puzzle-background::before,
#puzzle-background::after {
    content: '';
    position: absolute;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.95);
    background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.25) 30%, rgba(78, 143, 181, 0.06) 75%);
    box-shadow:
        inset -8px -10px 22px rgba(78, 143, 181, 0.2),
        0 2px 12px rgba(78, 143, 181, 0.15);
    pointer-events: none;
}
#puzzle-background::before {
    width: clamp(110px, 34%, 420px);
    top: -6%;
    left: -7%;
}
#puzzle-background::after {
    width: clamp(80px, 24%, 300px);
    bottom: 4%;
    right: -5%;
}
#puzzle {
    position: relative;
    z-index: 1;
}

/* Grid (SVG, sizes in viewBox units: one cell = 40) */
.rt-cell {
    fill: white;
    stroke: var(--rt-grid-line);
    stroke-width: 1;
}
.rt-cell.rt-solution-cell {
    fill: var(--rt-solution-cell);
}
.rt-number {
    fill: var(--rt-navy);
    font-size: 13px;
    font-weight: 700;
}
.rt-arrow {
    fill: var(--rt-navy);
}
.rt-solution-marker {
    fill: var(--rt-steel);
    font-size: 24px;
    font-weight: 900;
    font-style: italic;
    opacity: 0.75;
}
.rt-hl-word {
    fill: var(--rt-word-highlight);
}
.rt-hl-current {
    fill: var(--rt-current-highlight);
    stroke: var(--rt-navy);
    stroke-width: 2.5;
}
.rt-input-wrap {
    width: 100%;
    height: 100%;
}
#puzzle input {
    width: 100%;
    height: 100%;
    font-size: 32px;
    font-weight: 500;
    font-family: 'Quicksand', sans-serif;
    line-height: 1;
    color: var(--rt-navy);
    text-align: center;
    text-transform: uppercase;
    border: none;
    outline: none;
    background: transparent;
    padding: 0;
    margin: 0;
    caret-color: transparent;
}
.rt-zoom-viewport {
    width: 100%;
    max-width: min(90vw, calc(88vh * var(--rt-aspect, 1)));
    aspect-ratio: var(--rt-aspect, 1);
    margin: 0 auto;
    overflow: hidden;
}
#puzzle.is-zoomed .rt-zoom-viewport {
    max-width: none;
    aspect-ratio: auto;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 10px;
}
.puzzle-scaler {
    width: 100%;
    position: relative;
}
.rt-zoom-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-width: min(90vw, calc(88vh * var(--rt-aspect, 1)));
    margin: 0 auto 8px;
}
#puzzle.is-zoomed .rt-zoom-controls {
    max-width: none;
}
.rt-zoom-controls button {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1.5px solid var(--rt-navy);
    border-radius: 50%;
    background: white;
    color: var(--rt-navy);
    font-family: 'Quicksand', sans-serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s, color 0.2s;
}
.rt-zoom-controls button:focus-visible {
    outline: 2px solid var(--rt-steel);
    outline-offset: 2px;
}
@media (hover: hover) {
    .rt-zoom-controls button:hover:not(:disabled) {
        background: var(--rt-navy);
        color: white;
    }
}
.rt-zoom-controls button:active:not(:disabled) {
    background: var(--rt-navy);
    color: white;
}
.rt-zoom-controls button:disabled {
    opacity: 0.35;
    cursor: default;
}
.rt-zoom-level {
    min-width: 46px;
    text-align: center;
    font-weight: 700;
    color: var(--rt-navy);
}
.puzzle-scaler svg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

/* Solution row */
#solution-container {
    --rt-solution-size: clamp(22px, var(--rt-cell-px, 40px), 44px);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 24px auto 0;
    padding-bottom: 24px;
    max-width: 90vw;
}
.rt-solution-label {
    font-size: calc(var(--rt-solution-size) * 0.45);
    font-weight: 700;
    color: var(--rt-navy);
    margin-bottom: calc(var(--rt-solution-size) * 0.3);
}
.rt-solution-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: calc(var(--rt-solution-size) * 0.18);
    padding: calc(var(--rt-solution-size) * 0.25) calc(var(--rt-solution-size) * 0.3);
    background: var(--rt-navy);
    border-radius: 6px;
}
.rt-solution-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--rt-solution-size) * 0.12);
}
.rt-solution-field input {
    width: var(--rt-solution-size);
    height: var(--rt-solution-size);
    box-sizing: border-box;
    border: none;
    border-radius: 50%;
    background: white;
    color: var(--rt-navy);
    font-family: 'Quicksand', sans-serif;
    font-size: calc(var(--rt-solution-size) * 0.5);
    font-weight: 600;
    text-align: center;
    padding: 0;
    margin: 0;
    outline: none;
    pointer-events: none;
}
.rt-solution-letter {
    color: white;
    font-size: calc(var(--rt-solution-size) * 0.32);
    font-weight: 700;
    line-height: 1;
}

/* Clue sidebar (desktop) */
#clue-sidebar {
    flex: 0 0 380px;
    box-sizing: border-box;
    padding: 20px;
    background: var(--rt-surface);
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(2, 62, 124, 0.08);
    max-height: 80vh;
    overflow-y: auto;
    position: sticky;
    top: 100px;
    margin-left: 0;
    scrollbar-width: thin;
    scrollbar-color: #c5d8ef var(--rt-surface);
}
#clue-sidebar::-webkit-scrollbar {
    width: 4px;
}
#clue-sidebar::-webkit-scrollbar-track {
    background: var(--rt-surface);
}
#clue-sidebar::-webkit-scrollbar-thumb {
    background-color: #c5d8ef;
    border-radius: 4px;
}
#clue-sidebar h3,
#clue-sidebar h4 {
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-size: 10px;
    font-weight: 700;
    color: var(--rt-navy);
    opacity: 0.5;
    margin: 16px 0 6px;
}
.clue-item {
    cursor: pointer;
    margin-bottom: 4px;
    padding: 6px 8px 6px 11px;
    border-radius: 6px;
    border-left: 3px solid transparent;
    transition: background-color 0.2s, border-color 0.2s;
    line-height: 1.4;
}
.clue-item:hover {
    background-color: var(--rt-hover);
    border-left-color: #a5c8f0;
}
.clue-item.active {
    background-color: var(--rt-active);
    border-left-color: var(--rt-navy);
}
.clue-item .clue-number {
    font-weight: 700;
    font-size: 13px;
    color: var(--rt-navy);
    margin-right: 4px;
}

/* Mobile */
#mobile-instructions {
    margin: 0 20px;
}
#active-clue-popup {
    font-size: 12px;
    text-align: center;
    padding: 14px 18px;
    margin: 20px 10px 5px;
    max-width: 600px;
    background: var(--rt-surface);
    border: none;
    border-left: 3px solid var(--rt-navy);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(2, 62, 124, 0.1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
@media (max-width: 1024px) {
    #main-layout {
        flex-direction: column;
        align-items: center;
    }
    #clue-sidebar {
        display: none;
    }
}
@media (min-width: 1025px) {
    #mobile-instructions,
    #active-clue-popup {
        display: none !important;
    }
}
