/*
 * Wrist Caddie - phone stylesheet.
 *
 * Same screens and same model as the watch app (../index.html), laid out for a
 * touch screen instead of a 360 px bezel display: one thumb, big targets, and
 * everything that matters above the fold while walking a hole.
 */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    background: #07130d;
    color: #f7fff9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    -webkit-user-select: none;
    user-select: none;
}

body {
    overflow: hidden;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
}

input {
    font: inherit;
    color: inherit;
}

h1 {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 30px;
}

p {
    margin: 0;
}

.app {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 560px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    padding:
        calc(8px + env(safe-area-inset-top))
        calc(12px + env(safe-area-inset-right))
        calc(10px + env(safe-area-inset-bottom))
        calc(12px + env(safe-area-inset-left));
    flex-direction: column;
    background: radial-gradient(circle at 50% 0, #163a25 0, #0c2417 45%, #050b08 100%);
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 2px 4px 6px;
    flex: 0 0 auto;
}

.brand {
    color: #81d49a;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
}

.topbar-hint {
    color: #6f8a79;
    font-size: 12px;
}

.screen {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    padding: 6px 4px 4px;
    text-align: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.eyebrow {
    margin-bottom: 4px;
    color: #81d49a;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
}

.muted {
    color: #9fb3a6;
    font-size: 15px;
}

.confirm {
    margin-top: 8px;
    color: #ffb4b4;
    font-size: 14px;
}

/* Buttons --------------------------------------------------------------- */

.btn {
    min-height: 52px;
    margin-top: 10px;
    padding: 0 20px;
    border: 1px solid #2f5c41;
    border-radius: 26px;
    background: #10281b;
    font-size: 18px;
    font-weight: bold;
}

.btn.primary {
    border-color: #73e69a;
    background: #73e69a;
    color: #06210f;
}

.btn.danger {
    border-color: #8c3b3b;
    background: #2a1414;
    color: #ffd9d9;
}

.btn.ghost {
    border-color: transparent;
    background: transparent;
    color: #9fb3a6;
    font-weight: normal;
}

.btn.small {
    min-height: 44px;
    margin-top: 8px;
    font-size: 16px;
}

.btn:active {
    background: #ffffff;
    color: #06210f;
}

.btn:disabled {
    opacity: 0.4;
}

.btn.compact {
    min-height: 40px;
    margin: 8px auto 0;
    padding: 0 16px;
    font-size: 15px;
}

/* Resume ---------------------------------------------------------------- */

#screen-resume {
    justify-content: center;
}

/* Setup ----------------------------------------------------------------- */

#screen-setup {
    justify-content: flex-start;
}

.player-editor {
    display: flex;
    flex-direction: column;
}

.player-input-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.player-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid #2f5c41;
    border-radius: 26px;
    background: #0d2117;
    font-size: 18px;
}

.player-input:focus {
    border-color: #73e69a;
    outline: none;
}

.player-remove {
    width: 52px;
    height: 52px;
    margin-left: 8px;
    flex: 0 0 auto;
    border: 1px solid #2f5c41;
    border-radius: 26px;
    background: #10281b;
    font-size: 22px;
    line-height: 1;
}

.player-remove:disabled {
    opacity: 0.35;
}

.settings {
    margin-top: 14px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 6px 12px;
    border: 1px solid #1e3f2b;
    border-radius: 18px;
    background: #0b1d14;
}

.setting-label {
    color: #9fb3a6;
    font-size: 16px;
}

.stepper {
    display: flex;
    align-items: center;
}

.stepper button {
    width: 52px;
    min-width: 52px;
    height: 52px;
    min-height: 52px;
    border: 1px solid #2f5c41;
    border-radius: 26px;
    background: #10281b;
    font-size: 22px;
    line-height: 1;
}

.stepper button:active {
    background: #73e69a;
    color: #06210f;
}

.stepper-value {
    min-width: 56px;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
}

.presets {
    display: flex;
    margin-bottom: 10px;
}

.presets button {
    flex: 1 1 0;
    min-height: 48px;
    margin-right: 8px;
    border: 1px solid #2f5c41;
    border-radius: 24px;
    background: #10281b;
    font-size: 17px;
    font-weight: bold;
}

.presets button:last-child {
    margin-right: 0;
}

.presets button.selected {
    border-color: #73e69a;
    background: #1c4a2e;
    color: #d8ffe6;
}

.btn.start {
    margin-top: 6px;
    flex: 0 0 auto;
}

.range {
    color: #0a3d1f;
    font-weight: normal;
}

/* Scoring --------------------------------------------------------------- */

#screen-scoring {
    padding: 0 4px;
    overflow: hidden;
}

.hole-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
}

.hole-face {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hole-label {
    color: #81d49a;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 3px;
}

.hole-number {
    font-size: 54px;
    font-weight: bold;
    line-height: 58px;
}

.hole-progress {
    color: #9fb3a6;
    font-size: 14px;
}

.hole-step {
    width: 60px;
    min-width: 60px;
    height: 60px;
    min-height: 60px;
    flex: 0 0 auto;
    border: 1px solid #2f5c41;
    border-radius: 30px;
    background: #10281b;
    font-size: 30px;
    line-height: 1;
}

.hole-step:active {
    background: #73e69a;
    color: #06210f;
}

.hole-step:disabled {
    opacity: 0.3;
}

.hole-strip {
    display: flex;
    margin: 8px 0 6px;
    padding-bottom: 4px;
    flex: 0 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hole-strip button {
    min-width: 44px;
    height: 44px;
    margin-right: 6px;
    flex: 0 0 auto;
    border: 1px solid #1e3f2b;
    border-radius: 22px;
    background: #0b1d14;
    color: #9fb3a6;
    font-size: 15px;
}

.hole-strip button.current {
    border-color: #73e69a;
    background: #1c4a2e;
    color: #f7fff9;
    font-weight: bold;
}

.hole-strip button.filled {
    color: #d8ffe6;
}

.players {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.player-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 8px 10px 8px 14px;
    border: 1px solid #1e3f2b;
    border-radius: 20px;
    background: #0b1d14;
    text-align: left;
}

.player-card.selected {
    border-color: #73e69a;
    background: #122c1d;
    box-shadow: 0 0 0 1px #73e69a inset;
}

.player-card.bump {
    background: #1c4a2e;
}

.player-meta {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
}

.player-rank {
    color: #81d49a;
    font-size: 12px;
    font-weight: bold;
}

.player-name {
    overflow: hidden;
    font-size: 19px;
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-total {
    color: #9fb3a6;
    font-size: 13px;
}

.score-controls {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.score-step {
    width: 60px;
    min-width: 60px;
    height: 60px;
    min-height: 60px;
    border: 1px solid #2f5c41;
    border-radius: 30px;
    background: #10281b;
    font-size: 28px;
    line-height: 1;
}

.score-step:active {
    background: #73e69a;
    color: #06210f;
}

.score-step.minus {
    font-size: 30px;
}

.score-value {
    min-width: 56px;
    font-size: 32px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.score-value.zero {
    color: #4d6b59;
}

.finish {
    margin: 8px 0 4px;
    flex: 0 0 auto;
}

/* Complete -------------------------------------------------------------- */

#screen-complete {
    justify-content: flex-start;
}

.totals {
    display: flex;
    margin-top: 6px;
    flex-direction: column;
}

.total-row {
    display: flex;
    align-items: center;
    min-height: 64px;
    margin-bottom: 8px;
    padding: 0 18px;
    border: 1px solid #1e3f2b;
    border-radius: 20px;
    background: #0b1d14;
    text-align: left;
}

.total-row.leader {
    border-color: #73e69a;
    background: #122c1d;
}

.total-position {
    min-width: 26px;
    color: #81d49a;
    font-size: 15px;
    font-weight: bold;
}

.total-name {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    font-size: 19px;
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.total-score {
    margin-left: 10px;
    font-size: 26px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.total-hint {
    margin-left: 10px;
    color: #6f8a79;
    font-size: 22px;
}

.complete-actions {
    display: flex;
    margin-top: 6px;
    flex: 0 0 auto;
    flex-direction: column;
}

/* Scorecard ------------------------------------------------------------- */

.scorecard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
}

.scorecard-face {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scorecard-name {
    overflow: hidden;
    max-width: 46vw;
    font-size: 22px;
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scorecard-position {
    color: #9fb3a6;
    font-size: 13px;
}

.scorecard-list {
    display: flex;
    margin-top: 8px;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.scorecard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    padding: 0 18px;
    border-bottom: 1px solid #12291c;
    font-size: 17px;
}

.scorecard-row .hole {
    color: #9fb3a6;
}

.scorecard-row .strokes {
    font-size: 19px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.scorecard-row.empty .strokes {
    color: #4d6b59;
}

.scorecard-row.total {
    margin-top: 4px;
    border-bottom: none;
    border-top: 1px solid #2f5c41;
    font-weight: bold;
}

.scorecard-row.total .hole {
    color: #f7fff9;
}

/* QR -------------------------------------------------------------------- */

.qr-screen {
    justify-content: flex-start;
}

#qr-canvas {
    margin: 8px auto 0;
    border-radius: 8px;
    flex: 0 0 auto;
}

.qr-hint {
    margin-top: 8px;
    color: #9fb3a6;
    font-size: 14px;
}

.qr-modes {
    display: flex;
    margin-top: 10px;
    flex: 0 0 auto;
}

.qr-modes button {
    flex: 1 1 0;
    min-height: 48px;
    margin-right: 8px;
    border: 1px solid #2f5c41;
    border-radius: 24px;
    background: #10281b;
    font-size: 15px;
    font-weight: bold;
}

.qr-modes button:last-child {
    margin-right: 0;
}

.qr-modes button.selected {
    border-color: #73e69a;
    background: #1c4a2e;
    color: #d8ffe6;
}

.qr-actions {
    display: flex;
    margin-top: 4px;
    flex: 0 0 auto;
}

.qr-actions .btn {
    flex: 1 1 0;
    margin-left: 8px;
}

.qr-actions .btn:first-child {
    margin-left: 0;
}

/* Toast ----------------------------------------------------------------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 10;
    max-width: 84vw;
    padding: 12px 20px;
    border: 1px solid #2f5c41;
    border-radius: 24px;
    background: #10281b;
    color: #f7fff9;
    font-size: 15px;
    transform: translateX(-50%);
}

@media (max-height: 620px) {
    .hole-number {
        font-size: 40px;
        line-height: 44px;
    }

    .score-step,
    .hole-step {
        width: 52px;
        height: 52px;
    }

    .score-value {
        min-width: 46px;
        font-size: 26px;
    }
}
