:root {
    --bg: #f7f2ea;
    --paper: #fffaf3;
    --ink: #241f1a;
    --muted: #6d6256;
    --line: #ded1bd;
    --gold: #bc842d;
    --gold-dark: #8f5d19;
    --green: #496f5d;
    --red: #8b3f38;
    --blue: #405f8f;
    --shadow: 0 18px 42px rgba(44, 33, 22, .12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
}

a {
    color: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 72px;
    padding: 14px clamp(16px, 4vw, 44px);
    border-bottom: 1px solid rgba(222, 209, 189, .85);
    background: rgba(255, 250, 243, .94);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.brand-logo {
    width: 84px;
    height: 52px;
    object-fit: contain;
}

.side-nav a {
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.header-link,
.header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 8px;
    padding: 10px 16px;
    background: var(--gold-dark);
    color: #fffaf3;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.header-link {
    border: 1px solid var(--line);
    background: #fffaf3;
    color: var(--ink);
}

.header-action:hover,
.header-action.is-active {
    background: #754a14;
}

.header-link:hover,
.header-link.is-active {
    background: #efe3d0;
}

.side-nav a:hover {
    background: #efe3d0;
    color: var(--ink);
}

.site-shell {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: clamp(18px, 4vw, 44px);
    width: min(1220px, calc(100% - 32px));
    margin: 28px auto 56px;
}

.site-sidebar {
    align-self: start;
    position: sticky;
    top: 96px;
    display: grid;
    gap: 14px;
}

.sidebar-block,
.info-card,
.link-panel,
.candle-form,
.alert,
.candle-details,
.timer-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.sidebar-block {
    padding: 18px;
}

.sidebar-block h2,
.link-panel h2,
.candle-details h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.sidebar-block p,
.site-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.side-nav {
    display: grid;
    gap: 5px;
}

.side-nav a {
    padding: 8px 9px;
}

.site-main {
    min-width: 0;
}

.content-page .hero {
    min-height: auto;
    align-content: start;
    padding-top: 0;
}

.hero,
.form-hero,
.compact-hero {
    min-height: auto;
    align-content: start;
    padding-top: 0;
}

.hero,
.form-hero,
.not-found {
    min-height: min(560px, calc(100vh - 170px));
    display: grid;
    align-content: center;
    padding: clamp(30px, 6vw, 76px) 0;
}

.content-page .hero,
.form-hero,
.compact-hero {
    min-height: auto;
    padding-top: 0;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--gold-dark);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    max-width: 760px;
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(34px, 4vw, 44px);
    line-height: 1.08;
    letter-spacing: 0;
}

.lead {
    max-width: 760px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: clamp(18px, 2vw, 22px);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 11px 18px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
}

.button-primary {
    background: var(--gold-dark);
    color: #fffaf3;
}

.button-secondary {
    border-color: var(--line);
    background: #fffaf3;
    color: var(--ink);
}

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

.home-candle-section {
    display: grid;
    gap: 18px;
    margin: 20px 0;
    padding: clamp(18px, 4vw, 30px) 0;
}

.section-heading {
    max-width: 760px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.15;
}

.section-heading p:last-child {
    margin: 10px 0 0;
    color: var(--muted);
}

.home-candle-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: stretch;
}

.candle-table {
    min-height: 260px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
    gap: 12px 10px;
    align-items: start;
    padding: clamp(16px, 3vw, 24px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 250, 243, .82), rgba(239, 229, 214, .92)),
        linear-gradient(90deg, rgba(143, 93, 25, .12), rgba(73, 111, 93, .1));
    box-shadow: inset 0 -18px 0 rgba(143, 93, 25, .1), var(--shadow);
}

.home-candle-empty {
    align-self: center;
    margin: 0;
    color: var(--muted);
}

.table-candle {
    --candle-height-ratio: 1;
    position: relative;
    height: 212px;
    min-height: 212px;
    display: grid;
    grid-template-rows: 154px 52px;
    justify-items: center;
    align-items: start;
    border: 0;
    padding: 0 4px 6px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    transition: opacity .2s ease, transform .38s ease;
}

.table-candle[hidden] {
    display: none;
}

.table-candle:hover {
    transform: translateY(-3px);
}

.table-candle--burned_out {
    cursor: grab;
}

.table-candle--burned_out:active {
    cursor: grabbing;
}

.table-candle--extinguished {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath d='M15 2C23 11 21 21 15 27C8 21 6 11 15 2Z' fill='%23e95f1c'/%3E%3Cpath d='M15 12C18 16 17 22 15 25C12 21 12 16 15 12Z' fill='%23fff3a8'/%3E%3C/svg%3E") 15 3, pointer;
}

.table-candle.is-moving-to-basket {
    opacity: 0;
    transform: translate(140px, 28px) scale(.35) rotate(12deg);
}

.mini-candle-stage {
    position: relative;
    width: 74px;
    height: 154px;
    display: block;
    overflow: visible;
}

.mini-flame {
    position: absolute;
    z-index: 4;
    left: calc(50% - 9.5px);
    bottom: calc(45px + (82px * var(--candle-height-ratio)));
    width: 19px;
    height: 32px;
    border-radius: 52% 48% 52% 48%;
    background: radial-gradient(circle at 50% 60%, #fff8b5 0 24%, #ffb43c 50%, #d94d22 100%);
    filter: drop-shadow(0 0 12px rgba(217, 77, 34, .42));
    transform-origin: 50% 100%;
    animation: flameFlicker 1.25s infinite ease-in-out;
}

.mini-flame::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 12px;
    width: 7px;
    height: 15px;
    border-radius: 50%;
    background: #fff6bc;
}

.mini-wick {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: calc(35px + (82px * var(--candle-height-ratio)));
    width: 4px;
    height: 18px;
    border-radius: 999px;
    background: #4d321d;
    transform: translateX(-50%);
}

.mini-wax {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 12px;
    width: 44px;
    height: calc(28px + (82px * var(--candle-height-ratio)));
    min-height: 28px;
    border-radius: 12px 12px 7px 7px;
    background: linear-gradient(90deg, #ead0aa, #fff7e9 48%, #d3a65e);
    box-shadow: inset 10px 0 16px rgba(255, 255, 255, .34);
    transform: translateX(-50%);
}

.mini-wax::before {
    content: "";
    position: absolute;
    left: 0;
    top: -7px;
    width: 44px;
    height: 14px;
    border-radius: 50%;
    background: #fff4e4;
}

.mini-drip {
    position: absolute;
    top: 8px;
    width: 13px;
    border-radius: 999px;
    opacity: calc(.25 + (.75 * (1 - var(--candle-height-ratio))));
}

.mini-drip-left {
    left: -3px;
    height: 34px;
    background: #e7c995;
}

.mini-drip-right {
    right: -4px;
    height: 44px;
    background: #d9b473;
}

.mini-puddle {
    position: absolute;
    z-index: 1;
    left: 50%;
    bottom: 6px;
    width: calc(28px + (54px * (1 - var(--candle-height-ratio))));
    height: 10px;
    border-radius: 50%;
    background: rgba(217, 183, 119, .62);
    transform: translateX(-50%);
}

.mini-label {
    display: grid;
    gap: 2px;
    width: 100%;
    min-height: 42px;
    margin-top: 4px;
    text-align: center;
}

.mini-label strong {
    font-size: 13px;
    line-height: 1.2;
}

.mini-label small {
    color: var(--muted);
    font-size: 12px;
}

.table-candle--extinguished .mini-flame,
.table-candle--burned_out .mini-flame {
    opacity: 0;
    animation: none;
}

.table-candle--extinguished .mini-wick,
.table-candle--burned_out .mini-wick {
    background: #2b2118;
}

.table-candle--burned_out .mini-wax {
    background: linear-gradient(90deg, #bda179, #e4d1b2 48%, #9a774a);
}

@media (min-width: 1180px) {
    .candle-table {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}

.wax-basket {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf3;
    box-shadow: var(--shadow);
}

.basket-icon {
    width: 68px;
    height: 48px;
    border: 5px solid #8f5d19;
    border-top: 0;
    border-radius: 0 0 16px 16px;
    background: repeating-linear-gradient(90deg, rgba(143, 93, 25, .16) 0 10px, transparent 10px 20px);
}

.wax-basket h3,
.wax-basket p {
    margin: 0;
}

.wax-basket p {
    color: var(--muted);
    font-size: 14px;
}

.basket-count {
    color: var(--ink) !important;
    font-weight: 700;
}

.info-card,
.link-panel,
.candle-details {
    padding: clamp(18px, 3vw, 28px);
}

.info-card h2 {
    margin: 0 0 10px;
    font-size: 22px;
}

.info-card p {
    margin: 0;
    color: var(--muted);
}

.link-panel {
    margin-top: 18px;
}

.link-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.link-list a {
    display: grid;
    gap: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    text-decoration: none;
}

.link-list small {
    color: var(--muted);
    font-size: 12px;
}

.candle-form {
    display: grid;
    gap: 18px;
    padding: clamp(18px, 4vw, 34px);
}

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

label,
fieldset {
    display: grid;
    gap: 8px;
    min-width: 0;
}

label span,
legend {
    color: var(--ink);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

input,
select {
    min-height: 46px;
    padding: 10px 12px;
}

textarea {
    resize: vertical;
    padding: 12px;
}

fieldset {
    margin: 0;
    border: 0;
    padding: 0;
}

.duration-options,
.visibility-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.duration-choice,
.visibility-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}

.duration-choice input,
.visibility-options input {
    width: auto;
    min-height: auto;
}

.form-note {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.alert {
    margin-bottom: 18px;
    padding: 16px 18px;
    border-color: #d9afa7;
    background: #fff4f2;
}

.alert ul {
    margin: 8px 0 0;
}

.candle-page {
    display: grid;
    gap: 24px;
}

.candle-stage {
    min-height: min(620px, calc(100vh - 140px));
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(220px, 360px);
    justify-content: center;
    gap: clamp(18px, 4vw, 44px);
    align-items: center;
}

.timer-panel {
    padding: clamp(18px, 3vw, 26px);
}

.timer-panel h1 {
    font-size: clamp(34px, 4vw, 48px);
    line-height: 1.08;
}

.timer {
    margin: 18px 0 6px;
    font-size: clamp(38px, 5vw, 58px);
    font-weight: 700;
    line-height: 1;
}

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

.candle-svg {
    width: 100%;
    height: min(76vh, 640px);
    min-height: 500px;
    filter: drop-shadow(0 24px 28px rgba(46, 32, 18, .18));
}

.flame {
    transform-origin: 110px 130px;
    animation: flameFlicker 1.35s infinite ease-in-out;
}

.flame-inner {
    animation-duration: .92s;
}

.wax-drip {
    opacity: 0;
    transition: opacity .8s ease;
}

.wax-drip-side {
    filter: drop-shadow(0 2px 2px rgba(92, 57, 19, .12));
}

.wax-puddle {
    opacity: 0;
    transform-origin: 110px 724px;
    transition: opacity .8s ease;
}

.single-relight-form {
    margin-top: 18px;
}

@keyframes flameFlicker {
    0%, 100% {
        transform: scaleX(1) rotate(0deg);
    }
    35% {
        transform: scaleX(.92) rotate(-2deg);
    }
    68% {
        transform: scaleX(1.07) rotate(2deg);
    }
}

.candle-details dl {
    display: grid;
    gap: 12px;
    margin: 0 0 18px;
}

.candle-details dl div {
    display: grid;
    gap: 2px;
}

.candle-details dt {
    color: var(--muted);
    font-size: 13px;
}

.candle-details dd {
    margin: 0;
    font-weight: 700;
}

.my-candles-page {
    display: grid;
    gap: 20px;
}

.compact-hero {
    display: grid;
    padding-bottom: clamp(18px, 4vw, 36px);
}

.empty-state,
.stats-row,
.candle-list-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.empty-state {
    display: grid;
    justify-items: start;
    gap: 12px;
    padding: clamp(18px, 3vw, 28px);
}

.empty-state h2,
.candle-list-item h2 {
    margin: 0;
}

.empty-state p,
.candle-list-item p {
    margin: 0;
    color: var(--muted);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
}

.stats-row div {
    display: grid;
    gap: 4px;
    padding: 16px;
    background: #fffaf3;
}

.stats-row span,
.candle-list-item dt {
    color: var(--muted);
    font-size: 13px;
}

.stats-row strong {
    font-size: 28px;
    line-height: 1;
}

.candle-list {
    display: grid;
    gap: 12px;
}

.candle-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
    gap: 18px;
    padding: clamp(18px, 3vw, 24px);
}

.inline-action {
    grid-column: 1 / -1;
    justify-self: start;
}

.candle-list-item h2 {
    font-size: 24px;
}

.candle-list-item h2 a {
    text-decoration: none;
}

.candle-list-item dl {
    display: grid;
    gap: 8px;
    margin: 0;
}

.candle-list-item dl div {
    display: grid;
    gap: 2px;
}

.candle-list-item dd {
    margin: 0;
    font-weight: 700;
}

blockquote {
    margin: 18px 0;
    border-left: 4px solid var(--gold);
    padding: 8px 0 8px 16px;
    color: var(--muted);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 26px clamp(16px, 4vw, 44px);
    border-top: 1px solid var(--line);
    background: #efe5d6;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 920px) {
    .site-shell,
    .candle-stage {
        grid-template-columns: 1fr;
    }

    .site-sidebar {
        position: static;
        grid-row: 2;
    }

    .section-grid,
    .link-list,
    .field-grid,
    .home-candle-layout,
    .candle-list-item {
        grid-template-columns: 1fr;
    }

    .candle-stage {
        min-height: auto;
    }
}

@media (max-width: 680px) {
    .site-header,
    .site-footer {
        align-items: center;
        flex-direction: row;
    }

    h1 {
        font-size: 36px;
    }

    .hero,
    .form-hero,
    .not-found {
        min-height: auto;
    }

    .duration-options,
    .visibility-options,
    .stats-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .candle-svg {
        min-height: 440px;
        height: 68vh;
    }

    .wax-basket {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 460px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions,
    .header-action {
        width: 100%;
    }

    .header-actions {
        align-items: stretch;
        display: grid;
    }
}
