/* LITTLESITE · PARTS — phone's look: the bones every device shares
   (phone.js builds it; a device's own stylesheet in css/phones/ draws it).
   On a mobile device the desk's furniture is not shown; the app area lies
   between the status bar and the navigation row; a window is an app that
   takes the whole area with nothing of the desk's over it; the desk's
   menus are sheets from the bottom; the startup is a screen of its own.
   Heights are the visible viewport's (dvh), never 100vh, which on a phone
   is the screen with the browser's bar hidden. */
:root { --phone-status: 28px; --phone-nav: 48px; }

/* the desk's furniture is not on a phone */
.phone #taskbar, .phone #start-menu, .phone #desk-icons { display: none !important; }

/* the app area, whatever look the desk had (a Mac look moves #desktop down for its taskbar) */
.phone #desktop {
  position: fixed !important;
  top: calc(var(--phone-status) + env(safe-area-inset-top, 0px)) !important;
  bottom: calc(var(--phone-nav) + env(safe-area-inset-bottom, 0px)) !important;
  left: 0 !important;
  right: 0 !important;
  width: auto !important;
  height: auto !important;
}
.phone #window-layer { position: absolute; inset: 0; width: auto; height: auto; }

/* an app: the whole area, one in front, nothing of the desk's over it */
.phone .window,
.phone .window.kind-game {
  left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important;
  min-width: 0; min-height: 0;
  border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
}
.phone .window .titlebar, .phone .window .resize-handle { display: none !important; }
.phone-at-home #window-layer { visibility: hidden; }

/* the home screen: under the windows, shown when the visitor is home */
.phone-home { position: absolute; inset: 0; overflow-y: auto; padding: 16px 16px 24px; display: none; -webkit-overflow-scrolling: touch; }
.phone-at-home .phone-home { display: block; }
.phone-widget { margin: 8px 4px 24px; }
.phone-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 8px; }
/* the phone turned sideways: a shorter widget, more icons across */
@media (orientation: landscape) and (max-height: 500px) {
  .phone-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .phone-widget { margin-bottom: 12px; }
  .phone-gesture .phone-widget-time { font-size: 36px; }
  .phone-gesture .phone-widget-date { font-size: 13px; margin-top: 2px; }
}
.phone-app {
  min-height: 44px; padding: 4px 0; background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.phone-app-icon { width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; font-size: 30px; line-height: 1; border-radius: 16px; transition: transform 0.1s; }
.phone-app-label { font-size: 12px; line-height: 1.2; text-align: center; max-width: 100%; overflow-wrap: anywhere; }

/* the status bar and the navigation row, over the page's edges */
.phone-status {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
  height: calc(var(--phone-status) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; user-select: none; -webkit-user-select: none;
}
.phone-status-time { font-variant-numeric: tabular-nums; }
.phone-status-right { display: flex; align-items: center; gap: 8px; }
.phone-status-badges { white-space: nowrap; }
.phone-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10000;
  height: calc(var(--phone-nav) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center; justify-content: center;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.phone-pill { width: 160px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.phone-pill::before { content: ""; width: 134px; height: 5px; border-radius: 3px; background: currentColor; }
.phone-pill:focus-visible { outline: 2px solid var(--accent, #6c63ff); outline-offset: -4px; border-radius: 22px; }

/* the recents and the settings: over the app area */
.phone-recents, .phone-settings {
  position: fixed; left: 0; right: 0; z-index: 20000;
  top: calc(var(--phone-status) + env(safe-area-inset-top, 0px));
  bottom: calc(var(--phone-nav) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto; padding: 16px;
}
.phone-recents.hidden, .phone-settings.hidden, .phone-recents-empty.hidden, .phone-recents-clear.hidden { display: none !important; }
.phone-shell { display: contents; }   /* its bars and panels are fixed to the screen's edges */
.phone-sheet-title { font-size: 20px; font-weight: 600; margin: 4px 0 14px; }
.phone-cards { display: block; }
.phone-card { min-height: 64px; display: flex; align-items: center; gap: 12px; padding-left: 16px; margin-bottom: 10px; border-radius: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.phone-card-title { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-card-close { width: 48px; height: 48px; flex: none; background: none; border: 0; color: inherit; font-size: 18px; cursor: pointer; }
.phone-recents-empty { opacity: 0.7; font-size: 15px; }
.phone-recents-clear { min-height: 48px; padding: 0 20px; margin-top: 8px; border: 0; border-radius: 12px; font: inherit; font-size: 15px; cursor: pointer; }
.phone-row {
  width: 100%; min-height: 56px; padding: 8px 12px; display: flex; align-items: center; gap: 14px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.phone-row.still { cursor: default; }
.phone-row-icon { width: 28px; flex: none; font-size: 20px; text-align: center; }
.phone-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.phone-row-label { font-size: 15px; overflow-wrap: anywhere; }
.phone-row-value { font-size: 12px; opacity: 0.7; overflow-wrap: anywhere; }
.phone-switch { width: 48px; height: 28px; flex: none; position: relative; border-radius: 14px; }
.phone-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.phone-switch[aria-checked="true"]::after { left: 23px; }

/* the desk's menus are sheets from the bottom, each item a finger's height */
.phone .context-menu {
  left: 0 !important; right: 0; top: auto !important; bottom: 0;
  width: auto; min-width: 0; max-height: 70dvh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
}
.phone .context-menu-item { min-height: 48px; display: flex; align-items: center; padding: 0 20px; font-size: 16px; }
.phone #notice { bottom: calc(var(--phone-nav) + 12px + env(safe-area-inset-bottom, 0px)); }
.phone .square { bottom: calc(var(--phone-nav) + 8px + env(safe-area-inset-bottom, 0px)) !important; }

/* ---- the startup: the mark, then the lock ---- */
#phone-boot {
  position: fixed; inset: 0; z-index: 2147483647;
  background: #000000; color: #ffffff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; outline: none;
  opacity: 1; transition: opacity 0.35s ease-out;
}
#phone-boot.phone-boot-off { opacity: 0; }
.phone-boot-mark { display: flex; flex-direction: column; align-items: center; gap: 28px; }
#phone-boot[data-screen="lock"] .phone-boot-mark, #phone-boot[data-screen="start"] .phone-boot-mark { display: none; }
.phone-boot-glyph { font-size: 72px; line-height: 1; }
.phone-boot-bar { width: 120px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
.phone-boot-fill { height: 100%; width: 0; background: #ffffff; animation: phone-boot-fill 1.4s ease-in-out forwards; }
@keyframes phone-boot-fill { to { width: 100%; } }
.phone-lock { display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; padding-top: 18dvh; }
#phone-boot[data-screen="lock"] .phone-lock, #phone-boot[data-screen="start"] .phone-lock { display: flex; }
.phone-lock-time { font-size: 72px; font-weight: 200; letter-spacing: -2px; line-height: 1; }
.phone-lock-date { font-size: 16px; margin-top: 8px; opacity: 0.85; }
.phone-lock-chevron { margin-top: auto; font-size: 22px; line-height: 1; opacity: 0.8; animation: phone-lock-nudge 1.6s ease-in-out infinite; }
@keyframes phone-lock-nudge { 50% { transform: translateY(-6px); } }
.phone-lock-hint { background: none; border: 0; color: inherit; font: inherit; font-size: 14px; min-height: 48px; padding: 0 24px calc(16px + env(safe-area-inset-bottom, 0px)); opacity: 0.85; cursor: pointer; }
.phone-said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .phone-boot-fill { animation: none; width: 100%; }
  .phone-lock-chevron { animation: none; }
  #phone-boot { transition: none; }
  .phone-app-icon, .phone-switch::after { transition: none; }
}
