:root {
    --ink: #1a1a1f;
    --paper: #ece6da;
    --forest: #3f6b3a;
    --route: #d11f3f;
    --purple: #b026b0;
    --purple-deep: #7d1a7d;
    --panel: #16161c;
    --panel-2: #21212b;
    --muted: #8a8a99;
    --line: #33333f;
}
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
html,
body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--panel);
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    color: var(--paper);
    overscroll-behavior: none;
}
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
}

.screen {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
}
.screen.active {
    display: flex;
}
#menu,
#submenu,
#diffmenu,
#dbscreen,
#listscreen {
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 24px;
}
.brand {
    position: absolute;
    top: 34px;
    left: 0;
    right: 0;
    text-align: center;
}
.brand h1 {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--purple);
    font-weight: 700;
}
.brand p {
    margin: 6px 0 0;
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--muted);
    text-transform: uppercase;
}
.bigbtn {
    width: min(86vw, 420px);
    padding: 26px 28px;
    border-radius: 18px;
    background: var(--panel-2);
    color: var(--paper);
    border: 1px solid var(--line);
    font-size: 21px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition:
        transform 0.12s ease,
        border-color 0.12s ease;
}
.bigbtn:active {
    transform: scale(0.975);
}
.bigbtn .tag {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.bigbtn[data-k="long"] {
    border-left: 5px solid var(--forest);
}
.bigbtn[data-k="sprint"] {
    border-left: 5px solid var(--route);
}
.bigbtn[data-k="mix"] {
    border-left: 5px solid var(--purple);
}
.bigbtn.alt {
    padding: 22px 26px;
    font-size: 18px;
}
.sub-h {
    position: absolute;
    top: 34px;
    left: 24px;
    font-size: 12px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--muted);
}
.back-link {
    position: absolute;
    top: 28px;
    right: 24px;
    background: none;
    color: var(--muted);
    font-size: 13px;
    padding: 8px;
    z-index: 3;
}

/* skryta databazova zona vpravo dole v menu */
#db-hotspot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 74px;
    height: 74px;
    z-index: 2;
}
#db-reveal {
    position: absolute;
    bottom: 18px;
    right: 18px;
    padding: 12px 18px;
    border-radius: 12px;
    background: var(--purple-deep);
    color: var(--paper);
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: none;
    z-index: 3;
}
#db-reveal.show {
    display: block;
}

.field {
    width: min(86vw, 420px);
    padding: 16px 18px;
    border-radius: 12px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--paper);
    font-size: 16px;
}
.field::placeholder {
    color: var(--muted);
}
.note {
    font-size: 12px;
    color: var(--muted);
    width: min(86vw, 420px);
    line-height: 1.5;
}
.filebtn {
    width: min(86vw, 420px);
    padding: 18px;
    border-radius: 14px;
    background: var(--panel-2);
    border: 1px dashed var(--line);
    color: var(--paper);
    font-size: 15px;
    text-align: center;
}
.count {
    font-size: 13px;
    color: var(--purple);
}

.timer-row {
    width: min(86vw, 420px);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 18px;
}
.timer-row label {
    font-size: 14px;
    flex: 1;
}
.timer-row input {
    width: 80px;
    padding: 10px;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--paper);
    font-size: 16px;
    text-align: center;
}

/* seznam zavodu */
#race-list {
    width: min(92vw, 520px);
    overflow-y: auto;
    max-height: 78vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 60px;
    -webkit-overflow-scrolling: touch;
}
.race-item {
    padding: 18px 20px;
    border-radius: 14px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 17px;
}
.race-item .n {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.1em;
}
.race-item:active {
    transform: scale(0.98);
}

/* hra */
#game {
    background: #000;
}
#canvas-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
canvas {
    touch-action: none;
    max-width: 100%;
    max-height: 100%;
}
.hud {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(20, 20, 28, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.1s;
    z-index: 5;
}
.hud:active {
    transform: scale(0.9);
}
.hud.tl {
    top: 16px;
    left: 16px;
}
.hud.bl {
    bottom: 16px;
    left: 16px;
}
.hud.br {
    bottom: 16px;
    right: 16px;
}
.hud.mid {
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
}
.hud.mid:active {
    transform: translateX(-50%) scale(0.9);
}
.hud .lbl {
    position: absolute;
    bottom: -18px;
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-transform: uppercase;
    white-space: nowrap;
}
.badge {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 28, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 7px 16px;
    border-radius: 99px;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--purple);
    z-index: 5;
}
#countdown {
    position: absolute;
    top: 40%;
    left: 20%;
    transform: translateX(-50%);
    font-size: 100px;
    font-weight: 800;
    color: #fff;
    z-index: 5;
    letter-spacing: 0.02em;
    background: rgba(209, 31, 63, 0.92);
    padding: 10px 26px;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    white-space: nowrap;
    display: none;
    text-align: center;
}
#countdown.show {
    display: block;
}
#countdown.fired {
    background: rgba(176, 38, 176, 0.95);
    font-size: 20px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
