/* HelloStudentris: a 2009 candybar phone. The screen is the 176 x 220 canvas scaled up with hard pixels; under it
   (or beside it, on a wide screen) the controls picked in Options: the Nokia keypad, the big buttons, or nothing
   (swipe on the screen, or a keyboard / controller). main.js sizes everything to the window through the variables
   below. */

:root {
    --screen-w: 352px;
    --screen-h: 440px;
    --pad-w: 320px;
    --key-h: 40px;
    --body: #121a2a;
    --body-hi: #2a3954;
    --key: #d8dee8;
    --key-dark: #8f9aab;
    --ink: #0b1220;
    --accent: #36c8f2;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
html,
body {
    margin: 0;
    height: 100%;
    background: #060b16;
    color: #fff;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

#phone {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 16px;
    border-radius: 34px;
    background:
        radial-gradient(120% 60% at 50% 0%, rgba(120, 160, 220, 0.18), transparent 60%),
        linear-gradient(160deg, var(--body-hi), var(--body) 45%, #0a0f1a);
    box-shadow:
        0 0 0 2px #2b3b58,
        0 18px 60px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
body.layout-wide #phone {
    flex-direction: row;
    padding: 16px;
}
body.layout-bare #phone {
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
}
#earpiece {
    width: 64px;
    height: 6px;
    border-radius: 3px;
    background: #050810;
    box-shadow: inset 0 1px 2px #000;
}
body.layout-wide #earpiece,
body.layout-bare #earpiece {
    display: none;
}

#bezel {
    position: relative;
    padding: 8px;
    border-radius: 12px;
    background: #03060c;
    box-shadow: inset 0 0 0 1px #1c2740;
}
body.layout-bare #bezel {
    padding: 0;
    box-shadow: none;
    background: none;
}
#screen {
    display: block;
    width: var(--screen-w);
    height: var(--screen-h);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #00142a;
}

/* ---- the Nokia keypad ---- */
.controls {
    display: none;
}
body.controls-keypad #keypad,
body.controls-buttons #bigbuttons {
    display: grid;
}
#keypad {
    width: var(--pad-w);
    gap: calc(var(--key-h) * 0.18);
}
#keypad button,
#bigbuttons button {
    font: inherit;
    color: var(--ink);
    border: none;
    padding: 0;
    cursor: pointer;
    touch-action: none;
}
.kp-top {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    align-items: start;
    gap: 6px;
}
.soft {
    height: calc(var(--key-h) * 0.9);
    margin-top: calc(var(--key-h) * 0.15);
    border-radius: 14px 14px 22px 22px;
    background: linear-gradient(#e9eef5, #aab4c4);
    box-shadow:
        0 2px 0 #5d6779,
        inset 0 1px 0 #fff;
}
.soft span {
    display: block;
    width: 40%;
    height: 4px;
    margin: 0 auto;
    border-radius: 2px;
    background: #44506a;
}
.nav {
    position: relative;
    aspect-ratio: 1.25;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #f2f5fa, #9aa5b8 70%, #6d7890);
    box-shadow:
        0 3px 0 #4a5468,
        inset 0 1px 0 #fff;
}
.nav button {
    position: absolute;
    background: transparent;
}
.nav-up {
    left: 30%;
    right: 30%;
    top: 0;
    height: 30%;
}
.nav-down {
    left: 30%;
    right: 30%;
    bottom: 0;
    height: 30%;
}
.nav-left {
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 28%;
}
.nav-right {
    right: 0;
    top: 25%;
    bottom: 25%;
    width: 28%;
}
.nav-up::after,
.nav-down::after,
.nav-left::after,
.nav-right::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    border: 6px solid transparent;
    transform: translate(-50%, -50%);
}
.nav-up::after {
    border-bottom-color: #3a4560;
    margin-top: -3px;
}
.nav-down::after {
    border-top-color: #3a4560;
    margin-top: 3px;
}
.nav-left::after {
    border-right-color: #3a4560;
    margin-left: -3px;
}
.nav-right::after {
    border-left-color: #3a4560;
    margin-left: 3px;
}
.nav-ok {
    left: 32%;
    right: 32%;
    top: 30%;
    bottom: 30%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, #4b5a78, #1e2638) !important;
    box-shadow: inset 0 1px 0 #6a7a9a;
}
.kp-nums {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(var(--key-h) * 0.16) 10px;
}
.kp-nums button {
    height: var(--key-h);
    border-radius: 40% 40% 46% 46% / 50% 50% 60% 60%;
    background: linear-gradient(#f3f6fa, var(--key) 55%, var(--key-dark));
    box-shadow:
        0 2px 0 #59647a,
        inset 0 1px 0 #fff;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    padding-top: calc(var(--key-h) * 0.2);
}
.kp-nums b {
    font-size: calc(var(--key-h) * 0.48);
    line-height: 1;
}
.kp-nums i {
    font-style: normal;
    font-size: calc(var(--key-h) * 0.26);
    color: #4f5b72;
    text-transform: lowercase;
}
#keypad button.down,
#bigbuttons button.down {
    filter: brightness(0.82);
    transform: translateY(2px);
    box-shadow: 0 0 0 #000;
}

/* ---- the big buttons ---- */
#bigbuttons {
    width: var(--pad-w);
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
#bigbuttons .bb {
    height: calc(var(--key-h) * 1.5);
    border-radius: 14px;
    background: linear-gradient(#2f7fd0, #164a8a);
    color: #fff;
    box-shadow:
        0 3px 0 #0b2547,
        inset 0 1px 0 #6fb4f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
#bigbuttons .bb.small {
    height: var(--key-h);
    background: linear-gradient(#1c4f88, #0f2f57);
}
#bigbuttons b {
    font-size: calc(var(--key-h) * 0.5);
    line-height: 1;
}
#bigbuttons .small b {
    font-size: calc(var(--key-h) * 0.36);
}
#bigbuttons i {
    font-style: normal;
    font-size: calc(var(--key-h) * 0.24);
    color: #a8d8ff;
    letter-spacing: 0.06em;
}

/* ---- the name for the online scores, over the screen ---- */
#name-entry {
    position: absolute;
    inset: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 8%;
    background: rgba(0, 20, 42, 0.94);
    font-family: "Courier New", monospace;
    font-weight: bold;
    text-align: center;
}
body.layout-bare #name-entry {
    inset: 0;
}
#name-entry label {
    color: var(--accent);
    font-size: 15px;
    letter-spacing: 0.05em;
}
#name-entry input {
    font: inherit;
    font-size: 22px;
    text-transform: uppercase;
    text-align: center;
    padding: 8px;
    color: #fff;
    background: #0d3866;
    border: 2px solid #62aee6;
    border-radius: 0;
    outline: none;
}
#name-entry .row {
    display: flex;
    gap: 10px;
    justify-content: center;
}
#name-entry button {
    font: inherit;
    font-size: 16px;
    padding: 8px 18px;
    color: #fff;
    background: #1f78d8;
    border: 2px solid #62aee6;
    cursor: pointer;
}
#name-entry #name-skip {
    background: #0d3866;
}
#name-error {
    margin: 0;
    color: #ff6a6a;
    font-size: 13px;
}
.hidden {
    display: none !important;
}
