/* Variables */

:root {
    /* Section heights */

    --score-height: 9vh;
    --status-height: 8vh;
    --answers-height: 12vh;
    --nav-height: 12vh;

    /* Font sizes */
    --font-size-default-desktop: 2rem;
    --font-size-default-mobile: 1.5rem;

    --font-size-status-desktop: 1.4rem;
    --font-size-status-mobile: 1.2rem;

    --font-size-answer-desktop: 1.4rem;
    --font-size-answer-mobile: 1.2rem;

    --font-size-icon-desktop: 3rem;
    --font-size-icon-mobile: 2.5rem;
    --font-size-icon-label-desktop: 1.2rem;
    --font-size-icon-label-mobile: 0.8rem;
}

/* Sections */

body {
    background: var(--primary-text);
    color: var(--primary-text);
    margin: 0;
    padding: 0;
    font-family: Lato;
    font-size: var(--font-size-default-desktop);
}

.app {
    /* Fixed to the viewport height so long content scrolls inside a screen
       instead of pushing the buttons off the bottom. dvh accounts for mobile
       browser toolbars. */
    height: 100vh;
    height: 100dvh;
    width: 50%;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.score {
    height: var(--score-height);
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    padding-left: 20px;
    padding-right: 10px;
}

.logo {
    display: flex;
    align-items: center;
    color: var(--logo-text);
}
.logo-image {
    margin-right: 6px;
    position: relative;
    top: 6px;
}
.logo-text {
    font-size: 1.8rem;
}

/* Daily/Practice strip above the verse. Daily gets a bright gold so it
   stands out; practice is a plain gray. */
.mode-banner {
    display: none;
    padding: 6px 0;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--nav-bg);
}
.game-mode-banner-daily {
    background: #f2c14e;
}
.game-mode-banner-practice {
    background: #a3a19c;
}

.result-bar {
    display: flex;
    position: relative;
    top: 7px;
}
.result-wrapper {
    display: inline-block;
    position: relative;
    margin: -2px;
}

.result-wrapper svg {
    width: 36px;
    margin-left: 4px;
}

.result-wrapper .correct,
.result-wrapper .incorrect {
    display: none;
}
.result-wrapper .empty {
    display: inline-block;
}

.verse {
    background: var(--verse-bg);
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 0;
    flex: 1;
    min-height: 0; /* allow shrinking below the text height so it scrolls */
}

.verse p {
    margin-top: 0;
}
.status {
    height: var(--status-height);
    background: var(--primary-bg);
    font-size: var(--font-size-status-desktop);
    border-bottom: solid var(--division-border) 1px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.answers {
    height: var(--answers-height);
    background: var(--primary-bg);
    display: flex;
    justify-content: space-between;
    padding: 4px;
    align-items: center;
}
.answer {
    background: var(--answer-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    border-radius: 20px;
    margin: 4px;
    height: 80%;
    position: relative;
    top: 1px;
    font-size: var(--font-size-answer-desktop);
    border: none;
    border-bottom: solid var(--nav-bg) 3px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}
.answer:hover {
    transform: translateY(-2px);
}
.answer[disabled="disabled"] {
    transform: translateY(0px);
    cursor: default;
}

.answer.user-answer {
    border: solid;
}

.answer.correct {
    background: var(--answer-right-bg);
    color: white;
}
.answer.incorrect {
    background: var(--answer-wrong);
    color: white;
}

.status.correct {
    background: var(--answer-bg);
    background: var(--answer-right);
    color: white;
}
.status.incorrect {
    background: var(--answer-wrong);
    color: white;
}

.nav {
    height: var(--nav-height);
    background: var(--nav-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 18px;
}

.icon-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0px 30px;
    height: 100%;
    cursor: pointer;
    text-decoration: none;
    color: var(--icon-disabled);
}
.next-icon-wrapper {
    color: var(--icon-enabled);
    background: var(--icon-enabled-bg);
    border: none;
}
.next-icon-wrapper[disabled="disabled"] {
    color: var(--icon-disabled);
    background-color: inherit;
    cursor: auto;
}

.icon {
    font-size: var(--font-size-icon-desktop);
    display: flex;
    justify-content: center;
}

.icon-label {
    font-size: var(--font-size-icon-label-desktop);
    font-family: Arial, Helvetica, sans-serif;
    text-align: center;
}

.icon-answer {
    color: white;
    border-radius: 40px;
    width: 30px;
    height: 30px;
    font-size: 18px;
    position: absolute;
    top: -10px;
    right: -6px;
    background: red;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-answer-correct {
    background-color: var(--answer-right);
}

.icon-answer-incorrect {
    background-color: var(--answer-wrong);
}

.icon-answer-hidden {
    display: none;
}

@media only screen and (max-width: 1095px) {
    .app {
        width: 60%;
    }
    .result-wrapper svg {
        width: 36px;
    }
}

@media only screen and (max-width: 940px) {
    .app {
        width: 70%;
    }
}

/* Mobile */
@media only screen and (max-width: 800px) {
    body {
        font-size: var(--font-size-default-mobile);
    }
    .app {
        width: 80%;
    }
    .result-wrapper svg {
        width: 24px;
    }
    .status {
        font-size: var(--font-size-status-mobile);
    }
    .answer {
        font-size: var(--font-size-answer-mobile);
    }
    .icon-wrapper .icon {
        font-size: var(--font-size-icon-mobile);
    }
    .icon-wrapper .icon-label {
        font-size: var(--font-size-icon-label-mobile);
    }
}

@media only screen and (max-width: 625px) {
    .app {
        width: 90%;
    }
}
@media only screen and (max-width: 460px) {
    .app {
        width: 100%;
    }
}
@media only screen and (max-width: 380px) {
    .answer {
        font-size: 0.95rem;
    }
}

.translation {
    font-size: 0.9rem;
}

.screen {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/** Panel screens: game over, stats, about **/

/* Only the panel scrolls, so the nav stays pinned to the bottom */
.panel-screen {
    justify-content: space-between;
    background-color: var(--nav-bg);
    overflow: hidden;
}
.panel-screen .nav {
    flex-shrink: 0;
}

.panel {
    --muted-text: color-mix(in srgb, var(--primary-text) 65%, transparent);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 20px;
    font-size: 1.1rem;
    line-height: 1.5;
}

.panel a {
    color: var(--primary-text);
}

.muted {
    color: var(--muted-text);
}

.panel-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}
.panel-subtitle {
    margin: 0 0 20px 0;
    color: var(--muted-text);
}

.section-label {
    margin: 24px 0 10px 0;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-text);
}
.card .section-label {
    margin-top: 0;
}

.card {
    background: var(--primary-bg);
    border: solid 1px var(--division-border);
    border-radius: 12px;
    padding: 18px 20px;
}

/* Game over */

.go-score {
    text-align: center;
}
.go-score-num {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--answer-right);
}
.go-score-den {
    font-size: 1.6rem;
    color: var(--muted-text);
}
.go-heading {
    margin: 10px 0 4px 0;
    font-size: 1.5rem;
}
#go-mode {
    margin: 0;
    font-size: 1rem;
}
.go-practice {
    margin: 24px 0 0 0;
    text-align: center;
    font-size: 1rem;
}

/* Short screens (e.g. iPhone SE): tighten the game over screen so the score
   and histogram fit above the nav without scrolling */
@media only screen and (max-height: 760px) {
    #game-over .panel {
        padding: 12px 16px;
        line-height: 1.3;
    }
    #game-over .card {
        padding: 10px 14px;
    }
    .go-score-num {
        font-size: 2.4rem;
    }
    .go-score-den {
        font-size: 1.2rem;
    }
    .go-heading {
        margin: 4px 0 2px 0;
        font-size: 1.2rem;
    }
    #go-mode {
        font-size: 0.85rem;
    }
    #game-over .section-label {
        margin: 12px 0 6px 0;
    }
    #game-over .hist {
        gap: 2px;
    }
    #game-over .hist-row {
        font-size: 0.75rem;
        line-height: 1.2;
    }
    .go-practice {
        margin-top: 10px;
        font-size: 0.85rem;
    }
}

/* Stats */

.stat-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.stat-tile {
    background: var(--primary-bg);
    border: solid 1px var(--division-border);
    border-radius: 12px;
    padding: 12px 6px;
    text-align: center;
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
}
.stat-label {
    margin-top: 4px;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--muted-text);
}

@media only screen and (max-width: 420px) {
    .stat-tiles {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Histogram (shared by game over and stats) */

.hist {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.hist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}
.hist-label {
    width: 1em;
    text-align: right;
    color: var(--muted-text);
    font-variant-numeric: tabular-nums;
}
.hist-track {
    flex: 1;
}
.hist-bar {
    box-sizing: border-box;
    min-width: 2em;
    padding: 1px 8px;
    border-radius: 4px;
    text-align: right;
    font-weight: 700;
    background-color: var(--histogram-bar);
}
.hist-bar.zero {
    background-color: var(--primary-bg);
    color: var(--muted-text);
    font-weight: 400;
}
.hist-row.highlight .hist-bar {
    background-color: var(--answer-right);
    color: white;
}
.hist-row.highlight .hist-label {
    color: var(--primary-text);
    font-weight: 700;
}

/* About */

.lead {
    margin: 12px 0 20px 0;
    font-size: 1.25rem;
}
.how-to {
    margin: 0;
    padding-left: 1.4em;
}
.how-to li + li {
    margin-top: 6px;
}
.credits {
    margin: 20px 0 0 0;
    font-size: 0.95rem;
    color: var(--muted-text);
}
