/* What all pages share: the colors of dark and light mode (theme.js picks one), the font and the buttons */
@font-face {
    font-family: "Fredoka";
    src: url("/fredoka.woff2") format("woff2");
    font-weight: 400 700;
    font-display: swap;
}

:root {
    --bg: #17161c;
    --card: #26252e;
    --field: #26252e;
    --text: #f6f5f8;
    --soft-text: #d3d1da;
    --muted: #b9b7c2;
    --grey: #8a8894;
    --red: #ff5a5a;
    --accent: #c2e6ff;
    --switch-on: #c2ffe1;
    --switch-knob: #17161c;
    --edge: transparent;
    /* The same in both modes: your own place on the leaderboard, and text on pastel or white */
    --sky: #c2e6ff;
    --on-pastel: #17161c;
    color-scheme: dark;
}

/* The pastel colors are very light, so here the empty fields are darker than the colors that appear on them,
   and everything pastel has a thin edge */
:root[data-theme="light"] {
    --bg: #f4f3f7;
    --card: #ffffff;
    --field: #bdbbc8;
    --text: #17161c;
    --soft-text: #45434f;
    --muted: #5e5c69;
    --grey: #7a7884;
    --red: #d92d2d;
    --accent: #2f7fb5;
    --switch-on: #2a8f63;
    --switch-knob: #ffffff;
    --edge: rgb(0 0 0 / 0.16);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html, body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Fredoka", system-ui, sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

.page {
    min-height: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: max(env(safe-area-inset-top), 32px) 16px max(env(safe-area-inset-bottom), 24px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

h1 {
    margin: 0;
    font-size: 44px;
    font-weight: 700;
    line-height: 1.05;
}

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    padding: 8px 20px;
    border: 2px solid var(--grey);
    border-radius: 20px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 21px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.button.primary {
    min-height: 64px;
    border-color: var(--text);
    background: var(--text);
    color: var(--bg);
    font-size: 24px;
    font-weight: 600;
}

input[type="text"] {
    min-width: 0;
    height: 52px;
    padding: 0 14px;
    border: 2px solid var(--grey);
    border-radius: 14px;
    background: #ffffff;
    color: var(--on-pastel);
    font: inherit;
    /* 16px or more: iOS doesn't zoom in on the field */
    font-size: 20px;
}

/* The start page */
/* In the corner of the screen, also where the page is narrower than the screen. Its icon lines up with the edge
   of the page: the button is 8px wider than the icon on each side. */
.theme-button {
    position: absolute;
    top: max(env(safe-area-inset-top), 32px);
    right: calc(max(env(safe-area-inset-right), 16px) - 8px);
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    touch-action: manipulation;
}

.theme-button svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* The icon shows the mode a tap switches to */
.theme-button .moon,
:root[data-theme="light"] .theme-button .sun {
    display: none;
}

:root[data-theme="light"] .theme-button .moon {
    display: block;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 96px;
    padding: 16px;
    border-radius: 24px;
    background: var(--card);
    color: var(--text);
    text-decoration: none;
}

.game-card strong {
    display: block;
    font-size: 24px;
    font-weight: 600;
}

.game-card span.about {
    color: var(--soft-text);
    font-size: 17px;
}

.tiles {
    flex: none;
    display: grid;
    grid-template-columns: repeat(2, 26px);
    gap: 6px;
}

.tiles i {
    height: 26px;
    border-radius: 8px;
    box-shadow: inset 0 0 0 2px var(--edge);
}

/* The login page */
.login {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: auto 0;
}

.login p {
    margin: 0;
    color: var(--soft-text);
    font-size: 18px;
    line-height: 1.4;
}

.login .error {
    color: var(--red);
}
