@import url('https://fonts.googleapis.com/css2?family=Anton&family=Oswald:wght@400;500;600;700&family=Roboto+Slab:wght@600;700;800&display=swap');

:root {
    --navy: #0c4a92;
    --navy-deep: #08356c;
    --blue: #07518f;
    --ink: #141414;
    --paper: #f3ecdd;
    --line: #1a1a1a;
    --gold: #e8c36a;
    --silver: #c9cdd0;
    --bronze: #c58b58;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    font-family: 'Oswald', 'Arial Narrow', sans-serif;
    background: #e8e2d3;
}

.paper {
    background-color: var(--paper);
    background-image:
        radial-gradient(#142d4210 .8px, transparent .8px),
        linear-gradient(110deg, #fff8 0%, transparent 35%, #00000008 100%);
    background-size: 5px 5px, 100% 100%;
}

.topbar {
    height: 92px;
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 5vw;
    border-bottom: 6px solid #101820;
}

.brand, .live-brand { display: flex; align-items: center; gap: 14px; }

.brand img {
    width: 58px;
    height: 72px;
    object-fit: contain;
}

.brand span { display: block; letter-spacing: 4px; font-size: 13px; }
.brand strong { display: block; font-family: 'Roboto Slab', serif; font-size: 24px; letter-spacing: 1px; }
.topbar nav { display: flex; gap: 12px; }

.topbar nav a {
    color: #fff;
    text-decoration: none;
    padding: 10px 15px;
    border: 1px solid #ffffff66;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.topbar nav a.active, .topbar nav a:hover { background: var(--paper); color: var(--navy); }

.admin-wrap { max-width: 1450px; margin: 0 auto; padding: 35px 4vw 60px; }
.intro { margin-bottom: 25px; }
.eyebrow { color: var(--blue); font-weight: 700; letter-spacing: 4px; font-size: 13px; margin: 0 0 8px; }
.intro h1 { font-family: 'Roboto Slab', serif; font-size: clamp(32px, 4vw, 54px); line-height: 1; margin: 0 0 10px; text-transform: uppercase; }
.intro h1 em { color: var(--navy); font-style: normal; }
.intro > p:last-child { font-family: Arial, sans-serif; color: #555; }
.admin-grid { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.6fr); gap: 20px; }
.panel { background: #fffaf0d9; border: 2px solid #172c3d; box-shadow: 5px 5px 0 #07518f24; }
.panel-title { display: flex; justify-content: space-between; align-items: center; background: var(--navy); color: #fff; padding: 13px 17px; font-size: 18px; letter-spacing: 1.5px; }
.panel-title small { font-family: Arial, sans-serif; font-size: 11px; letter-spacing: 1px; color: #dbe8f1; }
.entry-panel form { padding: 22px; display: flex; flex-direction: column; gap: 9px; }
.entry-panel label, .reset-box label { font-size: 13px; letter-spacing: 1.5px; font-weight: 700; margin-top: 8px; }
.entry-panel label small { color: #777; }
.entry-panel input, .reset-box input { width: 100%; padding: 13px 14px; border: 2px solid #c6c0b2; background: #fff; font: 600 21px 'Oswald', sans-serif; outline-color: var(--blue); }
.hint { font: 12px Arial, sans-serif; color: #666; margin: 0 0 8px; }
.btn-primary, .btn-danger { border: 0; background: var(--navy); color: #fff; padding: 15px; font: 700 16px 'Oswald', sans-serif; letter-spacing: 1.5px; cursor: pointer; }
.btn-primary:hover { background: #0b659f; }
.quick-links { border-top: 1px solid #d5cdbc; padding: 15px 22px; }
.quick-links a { color: var(--navy); font-weight: 700; letter-spacing: 1px; text-decoration: none; }
.table-scroll { max-height: 470px; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: #e5dfd1; text-align: left; font-size: 12px; letter-spacing: 1.3px; padding: 12px 10px; }
td { padding: 11px 10px; border-top: 1px solid #c8c1b3; font-size: 16px; font-weight: 600; }
tbody tr:first-child td { background: #f5e3ad; }
tbody tr:nth-child(2) td { background: #e4e6e7; }
tbody tr:nth-child(3) td { background: #efd4b7; }
.empty { text-align: center; color: #777; padding: 30px; }
.attempts-panel { margin-top: 20px; }
.attempt-list { max-height: 350px; overflow: auto; }
.attempt-row { display: grid; grid-template-columns: 1fr 100px 120px 35px; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid #d5cdbc; font-family: Arial, sans-serif; }
.attempt-row span { color: #777; font-size: 13px; }
.attempt-row b { font-family: 'Oswald', sans-serif; font-size: 18px; }
.attempt-row form { margin: 0; }
.delete-btn { border: 0; background: transparent; color: #a22; font-size: 24px; cursor: pointer; }
.notice { padding: 12px 16px; margin: 0 0 18px; font-family: Arial, sans-serif; font-weight: 600; }
.success { background: #dcebd8; color: #28522a; }
.error { background: #f5d9d5; color: #852c24; }
.reset-box { margin-top: 20px; font-family: Arial, sans-serif; font-size: 13px; }
.reset-box form { max-width: 350px; display: grid; gap: 8px; padding: 15px 0; }
.btn-danger { background: #8c2525; font-size: 13px; }
footer { text-align: center; padding: 20px; color: #65707a; font-size: 12px; letter-spacing: 3px; }

.live-page {
    height: 100vh;
    overflow: hidden;
    color: #1a140e;
    background-color: #f4ecdc;
    background-image:
        radial-gradient(ellipse at center, transparent 46%, rgba(62, 42, 18, .2) 100%),
        radial-gradient(#3a2a1412 .7px, transparent .75px);
    background-size: 100% 100%, 4px 4px;
    display: grid;
    grid-template-columns: minmax(260px, 30vw) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
}

.brand-side {
    grid-row: 1 / span 2;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 22px 22px 78px;
    overflow: hidden;
    border-right: 8px solid #0c3f86;
}

.logo {
    width: min(86%, 300px);
    height: auto;
    filter: drop-shadow(6px 8px 0 rgba(16, 24, 32, .12));
}

.moustache {
    width: min(92%, 340px);
    height: auto;
    margin-top: -6px;
}

.ziel { text-align: center; margin-top: 8px; }
.ziel h2 {
    margin: 0;
    font-size: clamp(26px, 2.6vw, 42px);
    letter-spacing: .2em;
    font-weight: 700;
}
.target-time {
    margin-top: 4px;
    color: #0c3f86;
    font-weight: 700;
    font-size: clamp(54px, 5.6vw, 96px);
    line-height: .86;
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
    animation: target-glow 3.4s ease-in-out infinite;
}
.ribbon {
    display: inline-block;
    margin-top: 14px;
    background: #0c3f86;
    color: #fff;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.15;
    font-size: clamp(13px, 1.15vw, 18px);
    padding: 11px 28px;
    transform: rotate(-2.5deg);
    clip-path: polygon(7% 0, 93% 0, 100% 50%, 93% 100%, 7% 100%, 0 50%);
    animation: ribbon-sway 5.5s ease-in-out infinite;
}
.stripes {
    position: absolute;
    left: -12%;
    right: -4%;
    bottom: 14px;
    display: grid;
    gap: 12px;
    transform: rotate(-8deg);
    animation: stripes-drift 7s ease-in-out infinite;
}
.stripes i { display: block; height: 16px; background: #0c3f86; }

.live-head {
    position: relative;
    padding: 18px 28px 8px;
    text-align: center;
}
.live-kicker {
    margin: 0;
    color: #0c3f86;
    font-weight: 700;
    letter-spacing: .28em;
    font-size: 13px;
}
.live-head h1 {
    margin: 4px 0 0;
    font-family: 'Anton', Impact, sans-serif;
    font-weight: 400;
    font-size: clamp(48px, 5.8vw, 104px);
    line-height: .86;
    letter-spacing: .01em;
    color: #124f9c;
    text-shadow: 3px 3px 0 #1a140e;
}
.live-head h1 span {
    color: #1a140e;
    text-shadow: 3px 3px 0 #124f9c;
}
.year {
    margin: 6px 0 0;
    font-family: 'Anton', Impact, sans-serif;
    color: #124f9c;
    letter-spacing: .46em;
    text-indent: .46em;
    font-size: clamp(22px, 2.2vw, 36px);
}

.board-wrap {
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 28px 16px;
}
.challenge-bar {
    margin: 12px 0 0;
    background: #0c3f86;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 16px;
    font-weight: 700;
    letter-spacing: .16em;
    font-size: clamp(18px, 2vw, 34px);
}
.live-clock {
    position: absolute;
    top: 18px;
    left: 28px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}
#updated {
    color: #1a140e;
    font-size: clamp(20px, 1.8vw, 30px);
    letter-spacing: .08em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
#updated.is-tick { animation: clock-tick .4s ease; }
.live-pill {
    position: fixed;
    top: 16px;
    right: 24px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #0c3f86;
    color: #fff;
    border-radius: 8px;
    padding: 10px 18px 10px 14px;
    letter-spacing: .14em;
    font-size: clamp(18px, 1.6vw, 26px);
    line-height: 1;
    font-weight: 700;
    overflow: visible;
}
.live-pill i {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff2d2d;
    box-shadow: 0 0 0 0 rgba(255, 45, 45, .75);
    animation: live-pulse 1.3s ease-out infinite;
}
.live-pill i::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #ff2d2d;
    animation: live-ping 1.3s ease-out infinite;
}
@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 45, 45, .75); }
    70% { box-shadow: 0 0 0 12px rgba(255, 45, 45, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 45, 45, 0); }
}
@keyframes live-ping {
    0% { transform: scale(1); opacity: .65; }
    100% { transform: scale(2.6); opacity: 0; }
}

.board {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    border: 3px solid #1a140e;
    background: #fbf6ec;
}
.field-count {
    background: #0c3f86;
    color: #fff;
    border-radius: 8px;
    letter-spacing: .14em;
    font-weight: 700;
    font-size: clamp(12px, 1.05vw, 16px);
    line-height: 1;
    padding: 7px 12px;
}
.board-head, .rank-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1.4fr) minmax(120px, .8fr) minmax(140px, .9fr);
    align-items: center;
}
.board-head {
    position: relative;
    overflow: hidden;
    background: #082a5c;
    color: #fff;
    padding: 10px 12px;
    letter-spacing: .14em;
    font-size: clamp(13px, 1.2vw, 18px);
    font-weight: 600;
}
.board-head::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -40%;
    width: 35%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
    animation: head-sheen 4.8s ease-in-out infinite;
}
.board-head span:nth-child(2) { text-align: left; padding-left: 8px; }
.board-head span:nth-child(3),
.rank-row .time { text-align: center; }
.board-head span:nth-child(4),
.rank-row .delta { text-align: right; padding-right: 12px; }

#ranking-rows {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.rank-row {
    flex: 0 0 88px;
    border-bottom: 2px solid #1a140e;
    background: #fbf6ec;
    font-size: clamp(20px, 1.7vw, 30px);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.rank-row.rest {
    flex: 0 0 calc((100% - 264px) / 7);
    min-height: 0;
    font-size: clamp(14px, 1.15vw, 20px);
}
.rank-row:last-child { border-bottom: 0; }
.rank {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #0c3f86;
    color: #fff;
    font-weight: 700;
}
.rank-row.gold,
.rank-row.silver,
.rank-row.bronze { background: #fbf6ec; background-image: none; }
.rank-row.gold { color: #a67c12; }
.rank-row.silver { color: #6a7278; }
.rank-row.bronze { color: #a56b3a; }
.rank-row.gold .rank { background: #b08a1e; color: #fff; }
.rank-row.silver .rank { background: #8d949a; color: #fff; }
.rank-row.bronze .rank { background: #a56a38; color: #fff; }
.rank b { display: inline-block; }
.medal { width: 1.15em; height: 1.15em; flex: 0 0 auto; }
.medal.gold { --disc: #f4d15c; --ink: #7a5210; --ribbon: #e0a02a; }
.medal.silver { --disc: #f7f8f8; --ink: #5d666e; --ribbon: #c5cbcf; }
.medal.bronze { --disc: #efc08a; --ink: #6e4522; --ribbon: #c88848; }
.name { padding-left: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-new, .tag-up, .tag-down {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px 1px;
    font-style: normal;
    font-size: .62em;
    letter-spacing: .14em;
    vertical-align: middle;
    color: #fff;
    background: #0c3f86;
}
.tag-up { background: #1c8c3f; }
.tag-down { background: #c62828; }
.rank-row.is-new .tag-new { animation: tag-pop .5s cubic-bezier(.2, 1.4, .3, 1) both; }

.rank-row.is-enter {
    animation: row-enter .55s cubic-bezier(.16, .84, .32, 1) both;
    animation-delay: calc(var(--i) * 55ms);
}
.rank-row.is-new {
    position: relative;
    z-index: 4;
    animation: row-new 1.05s cubic-bezier(.16, .84, .32, 1) forwards;
}
.rank-row.is-up,
.rank-row.is-hold-up {
    color: #146b32;
    background-color: #d8f5e0;
    box-shadow: inset 10px 0 0 #1c8c3f;
}
.rank-row.is-down,
.rank-row.is-hold-down {
    color: #9d1c1c;
    background-color: #fde2dc;
    box-shadow: inset 10px 0 0 #c62828;
}
.rank-row.is-up .rank,
.rank-row.is-hold-up .rank { background: #1c8c3f; color: #fff; }
.rank-row.is-down .rank,
.rank-row.is-hold-down .rank { background: #c62828; color: #fff; }
.rank-row.is-up { animation: row-up .9s ease forwards; }
.rank-row.is-down { animation: row-down .8s ease forwards; }
.rank-row.is-hold-new { background-color: #fff6d8; box-shadow: none; }
.rank-row.is-hold-hot .time { background: #0c3f86; color: #fff; }
.rank-row.is-moving { transition: transform .75s cubic-bezier(.22, .8, .3, 1); }
.rank-row.is-hot .time { animation: time-flash .8s ease; }
.rank-row.is-new .rank b,
.rank-row.is-up .rank b,
.rank-row.is-down .rank b { animation: rank-pop .55s cubic-bezier(.2, 1.4, .3, 1); }
.rank-row.is-new .medal,
.rank-row.is-up .medal { animation: medal-pop .7s cubic-bezier(.2, 1.5, .3, 1); }

.live-flash {
    position: fixed;
    z-index: 25;
    right: 36px;
    bottom: 28px;
    padding: 14px 22px;
    background: #0c3f86;
    color: #fff;
    font-weight: 700;
    letter-spacing: .12em;
    font-size: clamp(16px, 1.4vw, 24px);
    opacity: 0;
    pointer-events: none;
    box-shadow: 6px 6px 0 #1a140e;
}
.live-flash.is-on { animation: flash-banner 18s ease both; }

@keyframes row-enter {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}
@keyframes row-new {
    0% { transform: translateX(105%); background-color: #ffe7a3; }
    62% { transform: translateX(-2%); background-color: #fff3cc; }
    100% { transform: none; background-color: #fff6d8; }
}
@keyframes row-up {
    0% { background-color: #b7ebc4; box-shadow: inset 10px 0 0 #1c8c3f; }
    100% { background-color: #d8f5e0; box-shadow: inset 10px 0 0 #1c8c3f; }
}
@keyframes row-down {
    0% { background-color: #f8c7c0; box-shadow: inset 10px 0 0 #c62828; }
    100% { background-color: #fde2dc; box-shadow: inset 10px 0 0 #c62828; }
}
@keyframes time-flash {
    0%, 35% { background: #0c3f86; color: #fff; }
    100% { background: transparent; color: inherit; }
}
@keyframes rank-pop {
    0% { transform: scale(.35); }
    100% { transform: none; }
}
@keyframes medal-pop {
    0% { transform: scale(0) rotate(-18deg); }
    100% { transform: none; }
}
@keyframes tag-pop {
    0% { transform: scale(.4); opacity: 0; }
    100% { transform: none; opacity: 1; }
}
@keyframes flash-banner {
    0% { opacity: 0; transform: translateY(16px); }
    6% { opacity: 1; transform: none; }
    90% { opacity: 1; transform: none; }
    100% { opacity: 0; transform: translateY(10px); }
}
@keyframes target-glow {
    0%, 100% { text-shadow: 0 0 0 transparent; }
    50% { text-shadow: 0 0 18px rgba(12, 63, 134, .35); }
}
@keyframes ribbon-sway {
    0%, 100% { transform: rotate(-2.5deg); }
    50% { transform: rotate(1.6deg); }
}
@keyframes stripes-drift {
    0%, 100% { transform: rotate(-8deg) translateX(0); }
    50% { transform: rotate(-6deg) translateX(12px); }
}
@keyframes clock-tick {
    0% { opacity: .45; }
    100% { opacity: 1; }
}
@keyframes head-sheen {
    0% { left: -40%; }
    55%, 100% { left: 130%; }
}

.empty-live {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: .16em;
    color: #6d675d;
    font-size: clamp(16px, 1.6vw, 24px);
    text-align: center;
    padding: 24px;
    animation: clock-tick 1.6s ease-in-out infinite alternate;
}

@media (max-width: 900px) {
    .admin-grid { grid-template-columns: 1fr; }
    .attempt-row { grid-template-columns: 1fr 75px 95px 25px; }
}

@media (prefers-reduced-motion: reduce) {
    .ribbon, .target-time, .stripes,
    .rank-row.is-new, .rank-row.is-up, .rank-row.is-down, .rank-row.is-enter,
    .rank-row.is-hot .time, .rank-row.is-new .rank b, .rank-row.is-up .rank b,
    .rank-row.is-new .medal, .rank-row.is-up .medal, .tag-new,
    .live-pill i, .live-pill i::after, #updated.is-tick, .board-head::after,
    .empty-live, .live-flash.is-on { animation: none; }
    .rank-row.is-moving { transition: none; }
    .live-flash.is-on { opacity: 1; }
}

