: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; }

/* ---- top bar ---- */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--bg-primary);
  border-bottom: 1px solid #23232f; flex-shrink: 0;
}
.title { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.hint-sm { font-size: 14px; color: var(--text-secondary); }
.muted { color: var(--text-secondary); }

/* ---- home ---- */
.home-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 20px 32px;
}
.preview {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 9px; line-height: 1; color: var(--accent);
  white-space: pre; text-shadow: 0 0 8px rgba(0, 212, 255, 0.35); margin-bottom: 6px;
}
.btn {
  width: 100%; max-width: 360px; min-height: 72px;
  border-radius: var(--radius-md); background: var(--bg-tertiary);
  color: var(--text-primary); font-size: 22px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: linear-gradient(135deg, rgba(10,132,255,0.28), rgba(0,212,255,0.18)); }
.btn.sm { min-height: 64px; font-size: 18px; flex: 1; }
.btn.danger { color: var(--danger); }
.hint { font-size: 14px; color: var(--text-muted); margin-top: 6px; text-align: center; }

/* ---- keyboard ---- */
.input-display {
  margin: 14px 16px; padding: 12px 18px; min-height: 60px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  font-size: 30px; font-weight: 600; letter-spacing: 1px;
  display: flex; align-items: center; overflow: hidden; white-space: nowrap; flex-shrink: 0;
}
#input-text { display: inline-block; }
#input-text:empty::before { content: 'Type\2026'; color: var(--text-muted); }
.caret {
  display: inline-block; width: 3px; height: 32px; background: var(--accent);
  margin-left: 3px; animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.keys {
  flex: 1; display: grid; grid-template-columns: repeat(10, 1fr);
  grid-auto-rows: 1fr; gap: 6px; padding: 4px 12px 14px;
}
.key {
  background: var(--bg-secondary); color: var(--text-primary);
  font-size: 24px; font-weight: 600; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; min-height: 44px;
}
.key.action { background: var(--bg-tertiary); font-size: 17px; font-weight: 700; }
.act-space { grid-column: span 4; }
.act-del { grid-column: span 2; }
.act-clear { grid-column: span 2; }
.act-done {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(0,255,136,0.18), rgba(0,212,255,0.18));
  color: var(--accent-secondary);
}

/* ---- result ---- */
.result-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 10px;
}
.art {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  white-space: pre; line-height: 1; color: var(--accent);
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.4); margin: 0;
}
.actions {
  display: flex; gap: 10px; padding: 14px 16px;
  background: var(--bg-primary); border-top: 1px solid #23232f; flex-shrink: 0;
}

/* ---- recent ---- */
.recent-list {
  flex: 1; display: flex; flex-direction: column; gap: 10px;
  padding: 16px; overflow-y: auto;
}
.recent-item {
  background: var(--bg-secondary); color: var(--text-primary);
  border-radius: var(--radius-md); min-height: 56px; font-size: 20px;
  padding: 0 18px; display: flex; align-items: center; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
}
.recent-list .btn.sm { width: 100%; max-width: none; flex: none; }

/* ---- toast ---- */
.toast {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--bg-tertiary); color: var(--text-primary);
  padding: 12px 22px; border-radius: 24px; font-size: 18px;
  border: 1px solid #2a2a3a; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); z-index: 10;
}
