.time5-page {
    padding-bottom: 4rem;
}

.time5-hero {
    padding: 1.5rem 0 0;
}

.time5-copy p {
    max-width: 60ch;
    color: var(--muted);
}

.time5-hero-actions,
.worksheet-actions,
.foxwell-bubble-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.time5-sheet-wrap {
    margin-top: 1.5rem;
}

.time5-sheet {
    padding: 2rem;
    border: 4px solid #1a1a1a;
    border-radius: 26px;
    background:
        radial-gradient(circle at top left, rgba(0, 0, 0, 0.08) 0 2px, transparent 3px 100%),
        radial-gradient(circle at top right, rgba(0, 0, 0, 0.08) 0 2px, transparent 3px 100%),
        #fffdf8;
    box-shadow: 0 18px 40px rgba(23, 38, 60, 0.08);
}

.worksheet-header {
    margin-bottom: 1.5rem;
}

.worksheet-header h2 {
    margin-bottom: 0.55rem;
    font-size: clamp(2rem, 4vw, 3rem);
    font-family: "Trebuchet MS", "Comic Sans MS", Arial, sans-serif;
}

.worksheet-header p {
    margin: 0;
    font-size: 1.15rem;
    color: #2d2d2d;
}

.worksheet-actions {
    margin-bottom: 1.5rem;
}

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

.time5-card {
    position: relative;
    padding: 1rem;
    border: 3px solid #1a1a1a;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.95);
    display: grid;
    gap: 0.85rem;
}

.time5-card.is-complete {
    border-color: #1e7b42;
}

.clock-stage {
    position: relative;
    display: flex;
    justify-content: center;
}

.clock-svg {
    width: min(100%, 180px);
    height: auto;
    touch-action: none;
}

.clock-face {
    fill: #fff;
    stroke: #111;
    stroke-width: 4;
}

.clock-tick {
    stroke: #111;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.clock-tick.hour {
    stroke-width: 4;
}

.clock-number {
    font: 700 16px/1 Arial, sans-serif;
    fill: #111;
    text-anchor: middle;
    dominant-baseline: middle;
}

.clock-hand {
    stroke: #111;
    stroke-linecap: round;
    cursor: grab;
}

.clock-hand.hour {
    stroke-width: 6;
}

.clock-hand.minute {
    stroke-width: 4;
}

.clock-hand.is-dragging {
    cursor: grabbing;
}

.clock-center {
    fill: #111;
}

.clock-label {
    text-align: center;
    font-family: "Trebuchet MS", "Comic Sans MS", Arial, sans-serif;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 900;
    color: #111;
}

.time5-actions {
    display: grid;
    gap: 0.65rem;
}

.feedback-text {
    min-height: 24px;
    text-align: center;
    font-weight: 800;
    font-size: 1rem;
}

.feedback-text.is-right {
    color: #1e7b42;
}

.feedback-text.is-wrong {
    color: #a11f1f;
}

.clock-check {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(46, 168, 95, 0.18);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.clock-check svg {
    width: 82px;
    height: 82px;
}

.time5-card.is-complete .clock-check {
    opacity: 1;
}

.foxwell-modal {
    position: fixed;
    inset: 0;
    z-index: 600;
}

.foxwell-overlay {
    position: absolute;
    inset: 0;
    background: rgba(14, 26, 41, 0.58);
}

.foxwell-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 940px);
    margin: min(8vh, 3rem) auto 0;
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 1rem;
    align-items: end;
}

.foxwell-character,
.foxwell-bubble {
    position: relative;
}

.foxwell-character {
    display: flex;
    align-items: end;
    justify-content: center;
    min-height: 360px;
}

.foxwell-character-image {
    width: 100%;
    max-width: 300px;
    transform-origin: center bottom;
}

.foxwell-character[data-state="happy"] .foxwell-character-image {
    animation: foxwell-bounce 1.3s ease-in-out infinite;
}

.foxwell-character[data-state="sad"] .foxwell-character-image {
    filter: saturate(0.72) brightness(0.92);
    animation: foxwell-sad 2.4s ease-in-out infinite;
}

.foxwell-character[data-state="sad"] .foxwell-rock {
    position: absolute;
    right: 18%;
    bottom: 14px;
    width: 26px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(180deg, #7a868f, #56616d);
    animation: foxwell-rock 2.4s ease-in-out infinite;
}

.foxwell-bubble {
    margin-bottom: 1rem;
    padding: 1.5rem;
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(23, 38, 60, 0.14);
}

.foxwell-bubble::before {
    content: '';
    position: absolute;
    left: -18px;
    bottom: 32px;
    width: 28px;
    height: 28px;
    background: #fff;
    clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

@keyframes foxwell-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-26px) scale(1.02); }
    50% { transform: translateY(-8px) scale(0.99); }
    75% { transform: translateY(-18px) scale(1.01); }
}

@keyframes foxwell-sad {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(-4px, 4px) rotate(-3deg); }
    50% { transform: translate(2px, 8px) rotate(1deg); }
    75% { transform: translate(-3px, 6px) rotate(-2deg); }
}

@keyframes foxwell-rock {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(20px); }
}

@media (max-width: 1120px) {
    .time5-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .foxwell-dialog {
        grid-template-columns: 1fr;
    }

    .foxwell-bubble::before {
        left: 40px;
        top: -18px;
        bottom: auto;
        width: 28px;
        height: 28px;
        clip-path: polygon(50% 0, 0 100%, 100% 100%);
    }
}

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

    .time5-grid {
        grid-template-columns: 1fr;
    }

    .time5-hero-actions,
    .worksheet-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}
