/* Display Check - Meta Ray-Ban Display calibration tool
 *
 * Additive waveguide display: emitted light ADDS to the real world.
 * #000000 emits nothing, so it is fully transparent. It is correct for the
 * page background and wrong for anything you need to see.
 */

:root {
  /* Page background. Transparent on device. */
  --bg-page:    #000000;

  /* UI surfaces. Must emit light to read as opaque. */
  --surface-1:  #0a0a0f;
  --surface-2:  #14161a;
  --surface-3:  #1c1e21;
  --surface-4:  #24262b;

  /* Text, per the display guidelines. */
  --text-primary:   #ffffff;
  --text-secondary: #e4e6eb;
  --text-muted:     #b0b3b8;

  --accent:      #00d4ff;
  --accent-glow: rgba(0, 212, 255, 0.45);
  --danger:      #ff4466;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Motion curves from the display guidelines. */
  --focus-on:  475ms cubic-bezier(0.6, 0, 0.4, 1);
  --focus-off: 625ms cubic-bezier(0.24, 0.24, 0.6, 1);
  --color-on:  300ms cubic-bezier(0.4, 0.04, 0.5, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: 600px;
  height: 600px;
}

/* ---------- Screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  /* 8dp safe margin. Anything at the bare edge gets clipped by rubberbanding. */
  padding: 8px;
}
.screen.hidden { display: none !important; }
.hidden { display: none !important; }

/* ---------- Header ---------- */
.header {
  flex-shrink: 0;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
}
.header h1 {
  flex: 1;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.header-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.back {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  font-size: 28px;
  line-height: 1;
  background: var(--surface-3);
  color: var(--text-primary);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ---------- Content ---------- */
.content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 4px;
}
.content.scroll { overflow-y: auto; scrollbar-width: none; }
.content.scroll::-webkit-scrollbar { display: none; }

/* Scrim. Signals more content below on any scrolling container. */
.content.scroll {
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 48px), transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 48px), transparent 100%);
}

.note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 4px 8px 8px;
}
.note em { color: var(--text-secondary); font-style: normal; font-weight: 600; }

.panel {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- Focus model ----------
 * Pinch fires Enter on document.activeElement, so focus IS the cursor.
 * Container scales down 8dp on target; content stays 1x for legibility.
 */
.focusable {
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--focus-off), border-color var(--color-on), box-shadow var(--color-on), background var(--color-on);
}
.focusable .fx {
  opacity: 0.8;
  transition: opacity var(--color-on);
}
.focusable:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: scale(calc(1 - 8 / 88));
  transition: transform var(--focus-on), border-color var(--color-on), box-shadow var(--color-on), background var(--color-on);
}
.focusable:focus .fx { opacity: 1; }

/* ---------- Rows (88dp tap target) ---------- */
.row {
  flex-shrink: 0;
  height: 88px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--surface-2);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  text-align: left;
  font-family: inherit;
}
.row:focus { background: var(--surface-3); }
.row-icon {
  width: 40px;
  flex-shrink: 0;
  font-size: 24px;
  text-align: center;
  color: var(--accent);
}
.row-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-title { font-size: 16px; font-weight: 600; }
.row-meta  { font-size: 12px; color: var(--text-muted); }

/* ---------- Nav bar ---------- */
.nav-bar {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  min-height: 56px;
}
.nav-item {
  flex: 1;
  height: 56px;
  background: var(--surface-3);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.nav-item:focus { background: var(--surface-4); }
.hint { font-size: 12px; color: var(--text-muted); }

/* ---------- Palette swatches ---------- */
.swatch {
  flex-shrink: 0;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.swatch-chip {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.10);
}
.swatch-body { display: flex; flex-direction: column; gap: 2px; }
.swatch-hex {
  font-size: 15px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.swatch-use { font-size: 12px; color: var(--text-muted); }

/* ---------- Type scale ---------- */
.t-h1 { font-size: 28px; font-weight: 700; }
.t-h2 { font-size: 22px; font-weight: 700; }
.t-b1 { font-size: 16px; font-weight: 400; line-height: 1.45; }
.t-b2 { font-size: 14px; font-weight: 400; line-height: 1.45; color: var(--text-secondary); }
.t-m1 { font-size: 12px; color: var(--text-muted); }
.t-m2 { font-size: 10px; color: var(--text-muted); }

/* ---------- Safe area probe ---------- */
#safe { padding: 0; }
.bleed { position: relative; width: 600px; height: 600px; overflow: hidden; }
.edge {
  position: absolute;
  border: 1px dashed rgba(0, 212, 255, 0.55);
  border-radius: 4px;
  pointer-events: none;
}
.edge-8  { inset: 8px; }
.edge-24 { inset: 24px; border-color: rgba(255, 255, 255, 0.25); }
.edge-tag {
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface-1);
  padding: 1px 5px;
  border-radius: 3px;
}
.corner {
  position: absolute;
  font-size: 20px;
  line-height: 1;
  height: 20px;
  color: var(--danger);
}
.corner.tl { top: 0; left: 2px; }
.corner.tr { top: 0; right: 2px; }
.corner.bl { bottom: 0; left: 2px; }
.corner.br { bottom: 0; right: 2px; }
.safe-center {
  position: absolute;
  inset: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}
.safe-center .t-b2 { max-width: 380px; }
.safe-center .nav-item { flex: 0 0 auto; width: 200px; margin-top: 6px; }

/* ---------- Input monitor ---------- */
.dpad {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 44px);
  gap: 6px;
  justify-content: center;
  align-content: center;
  padding: 6px 0;
}
.key {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text-muted);
  transition: background var(--color-on), color var(--color-on), transform 100ms cubic-bezier(0.68, 0, 0.29, 1);
}
.key.lit {
  background: var(--accent);
  color: #06131a;
  transform: scale(1.08);
}
.key[data-key="Escape"]     { grid-area: 1 / 1; font-size: 14px; }
.key[data-key="ArrowUp"]    { grid-area: 1 / 2; }
.key[data-key="ArrowLeft"]  { grid-area: 2 / 1; }
.key[data-key="Enter"]      { grid-area: 2 / 2; }
.key[data-key="ArrowRight"] { grid-area: 2 / 3; }
.key[data-key="ArrowDown"]  { grid-area: 3 / 2; }

.log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  gap: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.log::-webkit-scrollbar { display: none; }
.log-line { color: var(--text-secondary); }
.log-line .k { color: var(--accent); font-weight: 600; }
.log-empty { color: var(--text-muted); }
