/* ═══════════════════════════════════════════════════════
   FAUX OS V2.1 - Mobile Shell (Smartphone UI)
   ═══════════════════════════════════════════════════════ */

.shell { display: none; }

body.mode--mobile .shell {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: var(--z-content);
}

/* ═══════════════════════════════════════════════════════
   LOCKSCREEN
   ═══════════════════════════════════════════════════════ */
.lockscreen {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-overlay) + 10);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  padding-top: calc(env(safe-area-inset-top, 20px) + 48px);
  transition: opacity 0.5s var(--ease-out),
              transform 0.5s var(--ease-out);

  &.is-dismissed {
    opacity: 0;
    transform: translateY(-30vh);
    pointer-events: none;
  }
}

.lockscreen__brand {
  font-family: var(--font-pixel);
  font-size: 8px;
  letter-spacing: var(--tracking-pixel);
  color: var(--ink-faint);
  margin-bottom: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lockscreen__time {
  font-family: var(--font-display);
  font-size: clamp(4rem, 18vw, 7rem);
  font-weight: 200;
  letter-spacing: -0.05em;
  line-height: 1;
  opacity: 0.95;
}

.lockscreen__date {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  letter-spacing: var(--tracking-wide);
  margin-top: var(--sp-2);
  margin-bottom: auto;
}

.lockscreen__swipe {
  padding-bottom: calc(env(safe-area-inset-bottom, 20px) + var(--sp-6));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  animation: swipe-hint 2.5s var(--ease-smooth) infinite;
}

.lockscreen__swipe-bar {
  width: 40px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--ink-faint);
}

.lockscreen__swipe-text {
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: var(--tracking-wide);
}

@keyframes swipe-hint {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%      { transform: translateY(-8px); opacity: 0.9; }
}

/* ═══════════════════════════════════════════════════════
   STATUS BAR
   ═══════════════════════════════════════════════════════ */
.statusbar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  padding-top: env(safe-area-inset-top, 0);
  background: transparent;
  font-size: 10px;
  z-index: var(--z-menubar);
  flex-shrink: 0;
}

.statusbar__left {
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: var(--tracking-pixel);
  opacity: 0.45;
  display: flex;
  align-items: center;
  gap: 4px;
}

.statusbar__center {
  opacity: 0.35;
  max-width: 44vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.statusbar__right-group {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.statusbar__sound-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 11px;
  padding: 2px 6px;
  color: var(--ink-muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s, opacity 0.2s;
}

.statusbar__sound-toggle:active {
  color: var(--accent);
}

.statusbar__sound-toggle.is-muted {
  opacity: 0.3;
  text-decoration: line-through;
}

.statusbar__clock {
  font-variant-numeric: tabular-nums;
  opacity: 0.45;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════
   HOME SCREEN / APP GRID
   ═══════════════════════════════════════════════════════ */
.home-screen {
  flex: 1;
  display: none;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  &.is-active { display: flex; }
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6) var(--sp-4);
  padding: var(--sp-6) var(--sp-4);
  max-width: 100%;
  margin: 0 auto;
  align-content: center;
}

.app-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-1);
  background: transparent;
  border: none;
  border-radius: var(--r-lg);
  transition: transform var(--dur-fast) var(--ease-spring);

  &:active { transform: scale(0.88); }
}

.app-icon__glyph {
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-family: var(--font-pixel);
  font-size: var(--fs-base);
  transition: background var(--dur-fast),
              border-color var(--dur-fast),
              box-shadow var(--dur-fast);

  .app-icon:active & {
    background: rgba(255, 255, 255, 0.08);
  }
}

.app-icon__label {
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
  line-height: 1.2;
}

/* Legal footer on home screen — always one tap away */
.home-legal {
  flex-shrink: 0;
  text-align: center;
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-4) + 4px);
}

.home-legal__link {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  opacity: 0.45;
  padding: var(--sp-1) var(--sp-2);
  transition: opacity var(--dur-fast);

  &:active {
    opacity: 0.8;
  }
}

/* ═══════════════════════════════════════════════════════
   APP SHEET (fullscreen app view)
   ═══════════════════════════════════════════════════════ */
.app-sheet {
  position: fixed;
  top: 44px;
  left: 0; right: 0; bottom: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  z-index: calc(var(--z-content) + 5);
  animation: sheet-in 0.3s var(--ease-out);

  &.is-active { display: flex; }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sheet__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-4);
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--sp-4));
  padding-bottom: calc(env(safe-area-inset-bottom, 16px) + 76px);
}

/* ═══════════════════════════════════════════════════════
   NAVIGATION BAR (bottom)
   ═══════════════════════════════════════════════════════ */
.navbar-mobile {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(64px + env(safe-area-inset-bottom, 0));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: var(--sp-2);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--c-black);
  border-top: 2px solid var(--border-strong);
  z-index: calc(var(--z-dock) + 10);
}

.navbar-mobile__btn {
  width: 64px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  font-size: 22px;
  color: var(--ink-muted);
  transition: color var(--dur-fast),
              transform var(--dur-fast) var(--ease-spring);

  &:active {
    transform: scale(0.85);
    color: var(--accent);
  }
}

.navbar-mobile__label {
  font-size: 10px;
  letter-spacing: 0.02em;
  opacity: 0.6;
}

.navbar-mobile__btn--home {
  font-size: 22px;
}

.navbar-mobile__btn--legal {
  font-size: 16px;
  opacity: 0.35;
  justify-self: start;
  width: 44px;
}

/* Music button: align right */
.navbar-mobile__btn:last-child {
  justify-self: end;
}

/* ═══════════════════════════════════════════════════════
   WELCOME / INTRO OVERLAY (shared, both modes)
   ═══════════════════════════════════════════════════════ */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-overlay) + 5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: var(--sp-6);
  text-align: center;
  opacity: 1;
  transition: opacity 0.6s var(--ease-out);

  &.is-dismissed {
    opacity: 0;
    pointer-events: none;
  }
}

.welcome__pixel-tag {
  font-family: var(--font-pixel);
  font-size: 8px;
  letter-spacing: var(--tracking-pixel);
  color: var(--accent);
  margin-bottom: var(--sp-4);
}

.welcome__title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-bottom: var(--sp-3);
}

.welcome__subtitle {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: var(--leading-loose);
  max-width: 380px;
  margin-bottom: var(--sp-6);
}

.welcome__hints {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
  max-width: 300px;
  width: 100%;
}

.welcome__hint {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: left;
  border-left: 2px solid var(--accent);
}

.welcome__hint-glyph {
  font-family: var(--font-pixel);
  font-size: 10px;
  opacity: 0.5;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.welcome__hint-text {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  line-height: var(--leading-normal);
}

.welcome__hint--sound {
  cursor: pointer;
  background: none;
  justify-content: space-between;
  transition: border-color 0.2s, background 0.2s;
}

.welcome__hint--sound:active {
  border-color: var(--accent);
  background: rgba(232, 93, 48, 0.06);
}

.welcome__hint--sound.is-muted .welcome__hint-glyph {
  opacity: 0.3;
}

/* Toggle switch pill */
.welcome__sound-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--accent);
  flex-shrink: 0;
  transition: background 0.25s;
}

.welcome__sound-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 21px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  transition: left 0.25s var(--ease-spring);
}

.welcome__hint--sound.is-muted .welcome__sound-toggle {
  background: var(--border-strong);
}

.welcome__hint--sound.is-muted .welcome__sound-toggle::after {
  left: 3px;
}

.welcome__enter {
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: var(--tracking-pixel);
  padding: var(--sp-3) var(--sp-8);
  background: var(--ink);
  color: var(--bg);
  border: none;
  border: 2px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring),
              opacity var(--dur-fast);

  &:active { transform: scale(0.95); }
  &:hover  { opacity: 0.9; }
}
