:root {
    --ink: #2a1c0e;
    --ink-soft: #5a4330;
    --parch: #f3e2c1;
    --parch-2: #e8d0a4;
    --gold: #c9a227;
    --gold-2: #f0d36a;
    --burgundy: #6b1d2a;
    --green: #1f4d3a;
    --done: #2f7a4d;
    --part: #b8860b;
    --no: #8b1e1e;
    --locked: #8a7358;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "Comfortaa", sans-serif;
    background: radial-gradient(circle at 20% 10%, rgba(240,211,106,.12), transparent 28%), radial-gradient(circle at 90% 0%, rgba(107,29,42,.25), transparent 30%), #120c08 url("data:image/svg+xml,%3Csvg width='160' height='160' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 80h160M80 0v160' stroke='%231a120c' stroke-width='1'/%3E%3C/svg%3E");
    min-height: 100vh;
}

.sky {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.spark {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #f0d36a;
    border-radius: 50%;
    animation: tw 4s linear infinite;
    opacity: .7;
}

@keyframes tw {
    0%,100% {
        opacity: .15
    }

    50% {
        opacity: .9
    }
}

.page {
    position: relative;
    z-index: 1;
    max-width: 1220px;
    margin: 0 auto;
    padding: 24px 18px 80px;
}

header.hero {
    background: linear-gradient(180deg, #f7e7c6, #ecd4a6);
    border: 3px solid #5b3b16;
    box-shadow: 0 16px 40px rgba(0,0,0,.35), inset 0 0 40px rgba(120,70,20,.12);
    border-radius: 6px;
    padding: 22px 24px 16px;
}

.crest {
    display: flex;
    gap: 16px;
    align-items: center;
}

.crest-badge {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #f0d36a, #6b1d2a 55%, #1a120c);
    border: 3px solid #3c2410;
    display: grid;
    place-items: center;
    color: #f7e7c6;
    font-family: "Cormorant Garamond", serif;
    font-size: 34px;
    flex: 0 0 auto;
}

h1 {
    font-family: "Cormorant Garamond", serif;
    font-size: 40px;
    margin: 0;
    line-height: .95;
}

.latin {
    color: #6b1d2a;
    font-style: italic;
    font-family: "Cormorant Garamond", serif;
    font-size: 20px;
}

.sub {
    margin-top: 8px;
    color: var(--ink-soft);
    font-size: 14px;
    max-width: 820px;
    line-height: 1.5;
}

.houses {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.house {
    border: 1px solid #7a5728;
    background: rgba(255,255,255,.28);
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.tab {
    background: #2a1c0e;
    color: #f3e2c1;
    border: 1px solid #c9a227;
    padding: 10px 14px;
    cursor: pointer;
    font-family: inherit;
    border-radius: 3px;
}

    .tab.active {
        background: #6b1d2a;
        color: #f7e7c6;
    }

.panel {
    display: none;
}

    .panel.active {
        display: block;
    }

.quest {
    display: flex;
    flex-direction: column;
}

.step {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 0 14px;
    opacity: .32;
    filter: grayscale(.45);
    pointer-events: none;
    transition: .3s ease;
}

    .step.open, .step.current {
        opacity: 1;
        filter: none;
        pointer-events: auto;
    }

.rail {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.node {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid #8a7358;
    background: #2a1c0e;
    color: #f3e2c1;
    display: grid;
    place-items: center;
    font-family: "Cormorant Garamond", serif;
    font-size: 22px;
    z-index: 2;
}

.step.current .node {
    border-color: #c9a227;
    box-shadow: 0 0 18px rgba(240,211,106,.45);
}

.step.done-step .node {
    border-color: #2f7a4d;
    background: #1f4d3a;
}

.step.partial-step .node {
    border-color: #b8860b;
    background: #5a430c;
}

.arrow {
    width: 5px;
    flex: 1;
    min-height: 34px;
    margin: 6px 0;
    background: linear-gradient(#8a7358, #5b3b16);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform .5s ease;
    clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
}

    .arrow.shown {
        transform: scaleY(1);
        background: linear-gradient(#f0d36a, #6b1d2a);
    }

.card {
    background: linear-gradient(180deg, #f7e7c6, #e7cd9c);
    border: 2px solid #5b3b16;
    box-shadow: 4px 6px 0 rgba(26,18,12,.25);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.spell {
    font-family: "Cormorant Garamond", serif;
    color: #6b1d2a;
    font-size: 14px;
    letter-spacing: .8px;
    text-transform: uppercase;
    margin: 0 0 2px;
}

h3 {
    font-family: "Cormorant Garamond", serif;
    margin: 0 0 6px;
    font-size: 26px;
}

.why {
    background: rgba(107,29,42,.08);
    border-left: 3px solid #6b1d2a;
    padding: 8px 10px;
    font-size: 13px;
    color: #4a3220;
    margin: 6px 0 10px;
}

.projects {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(190px,1fr));
    gap: 8px;
    margin: 8px 0 10px;
}

.proj {
    background: #f8edd4;
    border: 1px dashed #7a5728;
    padding: 8px 10px;
    font-size: 13px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

select, input[type="date"], input[type="time"], textarea, input[type="text"] {
    background: #fff8ea;
    color: var(--ink);
    border: 1px solid #7a5728;
    border-radius: 3px;
    padding: 8px 10px;
    font: inherit;
}

textarea {
    width: 100%;
    min-height: 72px;
    margin-top: 8px;
}

.status {
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #7a5728;
    background: #fff8ea;
}

.s-done {
    color: #2f7a4d;
    border-color: #2f7a4d;
}

.s-part {
    color: #8a6508;
    border-color: #b8860b;
}

.s-no {
    color: #8b1e1e;
    border-color: #8b1e1e;
}

.s-wait {
    color: #6b5744;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px,1fr));
    gap: 14px;
}

.btn {
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    padding: 10px 14px;
}

.btn-gold {
    background: linear-gradient(#f0d36a,#c9a227);
    color: #2a1c0e;
}

.btn-ink {
    background: #2a1c0e;
    color: #f3e2c1;
    border: 1px solid #c9a227;
}

/* Day journal — wide and clear */
.journal {
    background: #f4e2bd;
    border: 3px solid #5b3b16;
    min-height: 520px;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    box-shadow: 0 18px 40px rgba(0,0,0,.35);
}

@media (max-width: 860px) {
    .journal {
        grid-template-columns: 1fr;
    }
}

.journal-left, .journal-right {
    padding: 20px;
}

.journal-left {
    border-right: 2px dashed #7a5728;
}

.journal h2 {
    font-family: "Cormorant Garamond", serif;
    margin: 0 0 6px;
    font-size: 32px;
}

.journal p.lead {
    margin: 0 0 14px;
    color: #5a4330;
}

.log-block {
    margin-bottom: 16px;
}

    .log-block h4 {
        margin: 0 0 8px;
        font-family: "Cormorant Garamond", serif;
        font-size: 22px;
        border-bottom: 1px solid #7a5728;
        padding-bottom: 4px;
    }

.log-line {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px dotted #c7ae80;
    font-size: 14px;
}

.owl {
    background: #2a1c0e;
    color: #f3e2c1;
    padding: 16px;
    min-height: 100%;
}

    .owl h3 {
        color: #f0d36a;
        font-size: 26px;
    }

    .owl p {
        color: #e8d0a4;
        font-size: 13px;
        line-height: 1.5;
    }

#owlLetter {
    width: 100%;
    min-height: 280px;
    background: #fff8ea;
    color: #2a1c0e;
    border: 1px solid #c9a227;
    font-size: 14px;
    line-height: 1.45;
}

.points {
    margin-top: 10px;
    font-family: "Cormorant Garamond", serif;
    font-size: 28px;
    color: #f0d36a;
}

select, input, textarea, .tab, .btn, .proj {
    font-size: 16px;
}

.tab, .btn, .proj {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.proj {
    width: 100%;
}

html {
    -webkit-text-size-adjust: 100%;
}

@media (max-width: 860px) {
    .page {
        padding: 12px 10px 90px;
    }

    header.hero {
        padding: 14px;
    }

    .crest {
        align-items: flex-start;
    }

    .crest-badge {
        width: 56px;
        height: 56px;
        font-size: 26px;
    }

    h1 {
        font-size: 28px;
    }

    .latin {
        font-size: 16px;
    }

    .step {
        grid-template-columns: 44px 1fr;
        gap: 0 8px;
    }

    .node {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    h3 {
        font-size: 22px;
    }

    .card {
        padding: 12px;
    }

    .tabs {
        position: sticky;
        top: 0;
        z-index: 5;
        background: rgba(18,12,8,.92);
        padding: 8px 0;
        margin: 10px 0;
    }

    .tab {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
    }

    .journal {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .journal-left {
        border-right: 0;
        border-bottom: 2px dashed #7a5728;
        padding: 14px;
    }

    .log-line {
        grid-template-columns: 24px 1fr;
    }

        .log-line span:last-child {
            grid-column: 2;
            color: #5a4330;
            font-size: 13px;
        }

    .grid {
        grid-template-columns: 1fr;
    }

    .projects {
        grid-template-columns: 1fr 1fr;
    }

    label {
        width: 100%;
    }

    select, input[type="date"], input[type="time"] {
        width: 100%;
    }

    .points {
        font-size: 22px;
        color: #6b1d2a;
    }

    .hedwig {
        right: 8px;
        bottom: 12px;
        width: 78px;
    }

        .hedwig svg {
            width: 78px;
            height: 78px;
        }

    .owl-letter {
        right: 10px;
        left: 10px;
        bottom: 96px;
        width: auto;
    }

        .owl-letter:after {
            display: none;
        }
}

.cup-wrap {
    display: grid;
    gap: 14px;
}

.rank-scale {
    display: grid;
    gap: 8px;
}

.ava {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #5b3b16;
}

.ava-lg {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #c9a227;
}

.today-hero {
    display: flex;
    gap: 14px;
    align-items: center;
    margin: 8px 0 10px;
}

.rank-row {
    display: grid;
    grid-template-columns: 64px 1fr 70px;
    gap: 10px;
    align-items: center;
    background: linear-gradient(180deg, #f7e7c6, #e7cd9c);
    border: 2px solid #5b3b16;
    padding: 8px 10px;
}

    .rank-row.on {
        box-shadow: 0 0 0 3px rgba(201,162,39,.45);
    }

.meter {
    height: 14px;
    background: #2a1c0e;
    border: 1px solid #5b3b16;
    overflow: hidden;
}

    .meter > span {
        display: block;
        height: 100%;
        background: linear-gradient(90deg,#6b1d2a,#f0d36a);
    }

.day-list {
    display: grid;
    gap: 10px;
}

.day-card {
    background: linear-gradient(180deg, #f7e7c6, #e7cd9c);
    border: 2px solid #5b3b16;
    padding: 12px 14px;
}

    .day-card h3 {
        margin-bottom: 4px;
    }

.rank-name {
    font-family: "Cormorant Garamond", serif;
    font-size: 22px;
    margin: 0;
}

.hedwig {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 20;
    width: 92px;
    cursor: pointer;
    user-select: none;
    transition: left 1.1s ease-in-out, top 1.1s ease-in-out, transform .4s ease;
}

    .hedwig.fly {
        pointer-events: none;
    }

    .hedwig svg {
        width: 92px;
        height: 92px;
        filter: drop-shadow(0 8px 12px rgba(0,0,0,.45));
    }

    .hedwig .wing-l {
        transform-origin: 70px 55px;
        animation: flapL 1.1s ease-in-out infinite;
    }

    .hedwig .wing-r {
        transform-origin: 30px 55px;
        animation: flapR 1.1s ease-in-out infinite;
    }

@keyframes flapL {
    0%,100% {
        transform: rotate(8deg)
    }

    50% {
        transform: rotate(-18deg)
    }
}

@keyframes flapR {
    0%,100% {
        transform: rotate(-8deg)
    }

    50% {
        transform: rotate(18deg)
    }
}

.hedwig.talk .body {
    animation: bob .4s ease-in-out infinite;
}

@keyframes bob {
    50% {
        transform: translateY(-4px)
    }
}

.owl-letter {
    position: fixed;
    right: 118px;
    bottom: 36px;
    z-index: 21;
    width: min(280px, calc(100vw - 140px));
    background: #fff8ea;
    color: #2a1c0e;
    border: 2px solid #5b3b16;
    padding: 12px 14px;
    font-family: "Cormorant Garamond", serif;
    font-size: 20px;
    line-height: 1.25;
    display: none;
    box-shadow: 6px 8px 0 rgba(26,18,12,.2);
}

    .owl-letter.show {
        display: block;
    }

    .owl-letter:after {
        content: "";
        position: absolute;
        right: -10px;
        bottom: 18px;
        border: 10px solid transparent;
        border-left-color: #5b3b16;
    }

.owl-hint {
    text-align: center;
    font-size: 11px;
    color: #f0d36a;
    margin-top: -6px;
}
