:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ---------- Home ---------- */
.app-header {
  padding: 16px 22px 10px;
  border-bottom: 1px solid var(--bg-tertiary);
}
.app-title { font-size: 30px; font-weight: 700; letter-spacing: 0.5px; }
.app-sub { display: block; font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

.text-card {
  margin: 14px 16px 4px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 64px;
  justify-content: center;
}
.text-card-label { font-size: 11px; letter-spacing: 1.5px; color: var(--text-muted); }
.text-card-value {
  font-size: 18px; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.text-card-value.placeholder { color: var(--text-muted); }

.menu { display: flex; flex-direction: column; gap: 10px; padding: 10px 16px 6px; }
.menu-item {
  display: flex; align-items: center; gap: 14px;
  min-height: 72px; padding: 0 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-align: left;
}
.menu-item.primary { background: #0f2630; }
.menu-badge {
  flex: 0 0 auto; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary); border-radius: 10px;
  font-size: 14px; font-weight: 700; color: var(--accent);
  text-transform: uppercase;
}
.menu-text { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.menu-label { font-size: 19px; font-weight: 600; }
.menu-desc { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-chev { flex: 0 0 auto; font-size: 24px; color: var(--accent); font-weight: 700; min-width: 24px; text-align: right; }

.recent { padding: 4px 16px 12px; overflow: hidden; flex: 1; }
.recent-title { font-size: 11px; letter-spacing: 1.5px; color: var(--text-muted); margin: 6px 2px; }
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  min-height: 46px; padding: 0 14px;
  display: flex; align-items: center;
  background: var(--bg-secondary); border-radius: 10px;
  color: var(--text-secondary); font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Editor ---------- */
.editor-head { padding: 14px 16px 8px; }
.io-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.io-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: 1.5px; color: var(--text-muted);
}
.io-count { color: var(--accent); letter-spacing: 0.5px; }
.io-display {
  margin-top: 8px; min-height: 56px; max-height: 84px; overflow-y: auto;
  font-size: 22px; line-height: 1.3; word-break: break-all; color: var(--text-primary);
}
.io-display .placeholder { color: var(--text-muted); }
.caret {
  display: inline-block; width: 2px; height: 22px; vertical-align: -4px;
  background: var(--accent); margin-left: 2px; animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.keyboard { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 6px 10px 12px; }
.kb-row { display: flex; gap: 7px; justify-content: center; }
.key {
  flex: 1 1 0; min-width: 0; min-height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); border-radius: 10px;
  color: var(--text-primary); font-size: 22px; font-weight: 500;
}
.key.special { background: var(--bg-secondary); color: var(--text-secondary); font-size: 18px; }
.key.special.active { background: #0f2630; color: var(--accent); }
.key.wide-space { flex: 3 1 0; }
.key.done { background: var(--accent-secondary); color: #002218; font-weight: 700; font-size: 24px; }

/* ---------- Result ---------- */
.result-head { padding: 12px 20px 8px; border-bottom: 1px solid var(--bg-tertiary); }
.result-title { font-size: 22px; font-weight: 700; }
.result-meta { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.qr-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 10px; }
#qr-canvas {
  background: #fff; border-radius: 8px;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.qr-msg {
  max-width: 460px; text-align: center; font-size: 17px; line-height: 1.45;
  color: var(--danger); padding: 24px;
}
.qr-text {
  padding: 2px 20px; text-align: center; font-size: 14px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.result-actions { display: flex; gap: 10px; padding: 10px 16px 14px; }
.act {
  flex: 1; min-height: 58px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 18px; font-weight: 600;
}

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--bg-tertiary); color: var(--text-primary);
  padding: 12px 22px; border-radius: 24px; font-size: 16px;
  border: 1px solid var(--accent); box-shadow: 0 0 24px var(--focus-glow);
  z-index: 10; max-width: 80%; text-align: center;
}
