:root {
  --bg:          #dde3db;
  --ink:         #14201a;
  --muted:       #566059;

  /* Device body — darker charcoal, closer to real ABS plastic */
  --shell-outer: #252a25;
  --shell-face:  #cdd4cb;
  --shell-edge:  #1a1e1a;
  --bezel:       #131510;

  /* Keys */
  --key-face:    #edf0e8;
  --key-edge:    #a0aba0;
  --key-shadow:  #707870;
  --accent:      #2e7068;
  --accent-hi:   #3d8880;

  /* Amber LCD — no blue anywhere */
  --lcd-bg:      #070400;
  --lcd-on:      #F09214;
  --lcd-glow:    rgba(230, 130, 10, 0.28);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

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

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 30%, rgba(46,112,104,0.10) 0%, transparent 55%),
    var(--bg);
}

button, textarea, input { font: inherit; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.workspace {
  width: min(1200px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(380px, 820px) minmax(260px, 340px);
  gap: 32px;
  align-items: center;
  padding: 32px 0;
}

.device-panel { display: flex; justify-content: center; }

/* ── Device shell ────────────────────────────────────────────────────────── */
.device {
  width: min(100%, 800px);
  border-radius: 12px 12px 24px 24px;
  background: var(--shell-outer);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 28px 60px rgba(0,0,0,0.40),
    0 4px 12px rgba(0,0,0,0.30);
  padding: 16px;
  transform: perspective(1400px) rotateX(2.5deg);
}

/* Inner face panel — the lighter ABS surface */
.device-face {
  background:
    linear-gradient(170deg, #d6ddd4 0%, var(--shell-face) 50%, #c4ccc2 100%);
  border-radius: 6px 6px 16px 16px;
  padding: clamp(16px, 2.4vw, 26px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
}

/* ── Brand row ───────────────────────────────────────────────────────────── */
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.brand {
  font-weight: 900;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* "No Blue Light" badge — amber on near-black, subtle pulse */
.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 20px;
  background: #120900;
  color: #E08A10;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(200,110,0,0.25);
}

.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #F09214;
  box-shadow: 0 0 6px #F09214;
  animation: pulse-amber 2.4s ease-in-out infinite;
}

@keyframes pulse-amber {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #F09214; }
  50%       { opacity: 0.5; box-shadow: 0 0 2px #F09214; }
}

/* ── LCD bezel ───────────────────────────────────────────────────────────── */
.lcd-wrap {
  padding: 12px;
  border-radius: 8px;
  background: var(--bezel);
  margin-bottom: 16px;
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.7),
    0 0 24px rgba(200,110,0,0.12);  /* ambient amber spill */
}

/* ── Canvas LCD — the actual display ─────────────────────────────────────── */
.lcd-canvas-wrap {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
  /* Glass reflection overlay */
  background: var(--lcd-bg);
}

.lcd-canvas-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    145deg,
    rgba(255,255,255,0.04) 0%,
    transparent 40%,
    rgba(0,0,0,0.10) 100%
  );
  pointer-events: none;
  z-index: 2;
  border-radius: 4px;
}

#lcd-canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;   /* crisp pixel grid — no blurring on scale-up */
  image-rendering: crisp-edges;
}

#lcd-canvas.backlight-off {
  filter: brightness(0.35);
}

/* ── Mode strip ──────────────────────────────────────────────────────────── */
.mode-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.mode-btn {
  height: 38px;
  border: 1px solid var(--key-edge);
  border-radius: 6px;
  background: linear-gradient(180deg, #fff 0%, var(--key-face) 100%);
  box-shadow: 0 3px 0 var(--key-shadow);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--ink);
  transition: color 0.1s, background 0.1s, border-color 0.1s;
}

.mode-btn.active {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border-color: #1f5550;
  color: #fff;
  box-shadow: 0 3px 0 #1a4440;
}

.mode-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--key-shadow); }

/* ── Alphabet keyboard ───────────────────────────────────────────────────── */
.keyboard {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.key {
  aspect-ratio: 1.1 / 1;
  border: 1px solid var(--key-edge);
  border-radius: 5px;
  background: linear-gradient(180deg, #ffffff 0%, var(--key-face) 100%);
  box-shadow: 0 3px 0 var(--key-shadow);
  cursor: pointer;
  font-weight: 800;
  font-size: clamp(0.9rem, 2.2vw, 1.45rem);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.key:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--key-shadow);
  background: linear-gradient(180deg, #f0f4ec 0%, #e2e8de 100%);
}

/* Function key (CLR) — visually distinct from letter keys */
.key-fn {
  background: linear-gradient(180deg, #e4e8e0 0%, #d4d8d0 100%);
  color: var(--muted);
  font-size: clamp(0.7rem, 1.6vw, 1rem);
  letter-spacing: 0.02em;
}

/* ── Control row ─────────────────────────────────────────────────────────── */
.control-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
}

.ctrl-btn {
  height: 42px;
  border: 1px solid var(--key-edge);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, var(--key-face) 100%);
  box-shadow: 0 3px 0 var(--key-shadow);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.ctrl-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--key-shadow);
}

/* ── Side panel ──────────────────────────────────────────────────────────── */
.side-panel { display: grid; gap: 16px; }

.panel-section {
  padding: 18px;
  border: 1px solid #b4bdb4;
  border-radius: 8px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(4px);
}

h1 { font-size: 1rem; font-weight: 800; margin-bottom: 14px; }
h2 { font-size: 0.95rem; font-weight: 800; margin-bottom: 12px; }

.spec-list { display: grid; gap: 11px; }
.spec-list > div { display: grid; gap: 2px; }

dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

dd { margin: 0; font-size: 0.92rem; line-height: 1.4; }

.spec-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 1px;
}

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid #a8b2a8;
  border-radius: 6px;
  padding: 9px;
  background: #f8faf6;
  line-height: 1.4;
  font-size: 0.88rem;
}

.apply-btn {
  width: 100%;
  height: 38px;
  margin-top: 9px;
  border: 1px solid #1f5550;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 #1a4440;
}

.apply-btn:active { transform: translateY(1px); box-shadow: none; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.note {
  margin-top: 10px;
  font-size: 0.80rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .device { transform: none; }
}

@media (max-width: 560px) {
  .workspace { width: calc(100vw - 20px); padding: 12px 0 24px; }
  .keyboard {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }
  .key { aspect-ratio: 1 / 0.9; }
  .control-row { grid-template-columns: 2fr 1fr 1fr; gap: 6px; }
}
