/* =====================================================================
   EjNET — Nokia 3310. Экран и кнопки.
   Картинка корпуса: nokia.jpg в корне сайта (как и раньше).
   Заставка при включении: boot.png в корне сайта.
   ===================================================================== */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: sans-serif;
    background: #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
}

/* ---------- Корпус ---------- */
.nokia-wrapper {
    --s: 1;                                   /* масштаб, считается в ui.js */
    position: relative;
    width: min(400px, 94vw);
    aspect-ratio: 400 / 680;
    background: url('../nokia.jpg') no-repeat center center;
    background-size: 100% 100%;
    border-radius: 40px;
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.3);
}
@supports not (aspect-ratio: 1 / 1) {
    .nokia-wrapper { width: 400px; height: 680px; }
}

/* ---------- Экран ---------- */
.nokia-screen {
    position: absolute;
    top: 26.5%;
    left: 25%;
    width: 49%;
    height: 21.5%;
    background: #75A279;
    border-radius: 2px;
    padding: calc(3px * var(--s)) calc(5px * var(--s));
    color: #111;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: calc(12px * var(--s));
    line-height: 1.2;
    overflow: hidden;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

/* ---------- Заставка при включении ----------
   boot.png растягивается ровно на весь экран и полностью его закрывает.
   Показывается только пока идёт загрузка (на экране стоит .t-logo). */
.boot-img {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    z-index: 5;
    pointer-events: none;
}
.nokia-screen:has(.t-logo) .boot-img { display: block; }
.nokia-screen:has(.t-logo) > :not(.boot-img) { visibility: hidden; }

.scr-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: calc(10px * var(--s));
    min-height: calc(13px * var(--s));
    border-bottom: 1px solid #111;
    padding-bottom: 1px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
}
#hLeft, #hRight { min-width: 25%; }
#hMid { flex: 1; text-align: center; overflow: hidden; }
#hRight { text-align: right; }

.scr-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.scr-soft {
    text-align: center;
    min-height: calc(14px * var(--s));
    font-size: calc(12px * var(--s));
    border-top: 1px dotted rgba(17, 17, 17, 0.35);
    white-space: nowrap;
    overflow: hidden;
}

/* ---------- Содержимое экрана ---------- */
.t-title {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    border-bottom: 1px solid #111;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    flex: none;
}
.t-title span:first-child { overflow: hidden; text-overflow: ellipsis; }

.t-center { text-align: center; }
.t-small  { font-size: 0.85em; }
.t-big    { font-size: 1.35em; text-align: center; word-break: break-all; }
.t-name   { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-status { white-space: pre-line; }

.t-scroll { flex: 1; min-height: 0; overflow: hidden; }
.t-text   { white-space: pre-wrap; word-wrap: break-word; }
.t-input  { white-space: pre-wrap; word-break: break-word; }
.t-input u { text-decoration: underline; }

.t-note {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: pre-line;
}

/* запасной вариант, если браузер не покажет boot.png */
.t-logo {
    font-size: 2em;
    text-align: center;
    letter-spacing: 2px;
    margin-top: 10%;
}
.t-off {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.85em;
    opacity: 0.6;
}

/* списки меню */
.list { flex: 1; min-height: 0; overflow: hidden; position: relative; }
.row  { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.row.sel { background: #111; color: #75A279; }

/* главное меню: один пункт на экран */
.menu-icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6em;
    line-height: 1;
}

/* ожидание */
.idle-net  { font-size: 1.25em; text-align: center; margin-top: 2px; }
.idle-date { font-size: 0.9em; text-align: center; }
.idle-info { font-size: 0.85em; text-align: center; }

.bars { letter-spacing: -1px; }
.dim  { opacity: 0.25; }

.cursor { animation: ej-blink 1s steps(1) infinite; }
@keyframes ej-blink { 50% { opacity: 0; } }

/* ---------- Зоны кнопок на картинке ----------
   Полностью невидимые: никакой подсветки при нажатии. */
.btn,
.btn:hover,
.btn:active,
.btn:focus,
.btn.down {
    background: transparent;
    outline: none;
    box-shadow: none;
}
.btn {
    position: absolute;
    padding: 0;
    margin: 0;
    border: none;
    opacity: 0;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.navi-key { top: 51.0%; left: 35%; width: 30%; height: 6%; border-radius: 20px; }
.c-key    { top: 54.5%; left: 23%; width: 14%; height: 6%; transform: rotate(-25deg); }
.up-key   { top: 53.5%; left: 66%; width: 12%; height: 4%; border-radius: 10px; transform: rotate(20deg); }
.down-key { top: 60.0%; left: 54%; width: 12%; height: 4%; border-radius: 10px; transform: rotate(20deg); }

.key-1    { top: 65.5%; left: 22%; width: 14%; height: 5%; }
.key-2    { top: 66.5%; left: 43%; width: 14%; height: 5%; }
.key-3    { top: 65.5%; left: 64%; width: 14%; height: 5%; }
.key-4    { top: 72.5%; left: 22%; width: 14%; height: 5%; }
.key-5    { top: 73.5%; left: 43%; width: 14%; height: 5%; }
.key-6    { top: 72.5%; left: 64%; width: 14%; height: 5%; }
.key-7    { top: 79.5%; left: 24%; width: 14%; height: 5%; }
.key-8    { top: 80.5%; left: 43%; width: 14%; height: 5%; }
.key-9    { top: 79.5%; left: 62%; width: 14%; height: 5%; }
.key-star { top: 86.5%; left: 26%; width: 14%; height: 5%; }
.key-0    { top: 87.5%; left: 43%; width: 14%; height: 5%; }
.key-hash { top: 86.5%; left: 60%; width: 14%; height: 5%; }

/* ---------- Под телефоном ---------- */
.volume-control { margin-top: 20px; text-align: center; color: #333; font-size: 14px; width: min(350px, 90vw); }
.volume-control input[type=range] { width: 100%; }
.hint { margin-top: 8px; color: #777; font-size: 12px; text-align: center; padding: 0 10px; }

@media (max-width: 440px) {
    body { padding: 8px 0; }
    .hint { display: none; }
}
