: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', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

.screen {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 14px;
}

.screen.hidden {
  display: none;
}

.focusable {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
}

.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 24px var(--focus-glow);
  background: var(--bg-tertiary);
}

.hidden {
  display: none !important;
}

/* === Home === */
.home-header {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.date-label {
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.total-amount {
  font-size: 54px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.entry-count {
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.3px;
}

.category-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
}

.cat-btn {
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
}

.cat-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0a0a0f;
  font-size: 20px;
  flex-shrink: 0;
}

.cat-name {
  font-size: 17px;
  font-weight: 500;
  text-align: left;
}

.history-btn {
  border-radius: var(--radius-md);
  min-height: 52px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* === Amount Entry === */
.amount-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.amount-cat-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0a0a0f;
  font-size: 16px;
  background: var(--accent);
}

.amount-cat-name {
  font-size: 18px;
  font-weight: 500;
}

.amount-display {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  text-align: center;
  font-size: 44px;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.25);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.numpad {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
}

.numpad-btn {
  border-radius: var(--radius-md);
  font-size: 26px;
  font-weight: 600;
}

.numpad-btn.special {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 22px;
}

.amount-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  flex: 1;
  border-radius: var(--radius-md);
  min-height: 52px;
  font-size: 16px;
  font-weight: 600;
}

.action-btn.cancel {
  color: var(--text-secondary);
}

.action-btn.save {
  background: var(--accent);
  color: #0a0a0f;
}

.action-btn.save:focus {
  background: var(--accent);
  border-color: #ffffff;
  box-shadow: 0 0 24px var(--focus-glow);
}

.action-btn.save.disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.action-btn.save.disabled:focus {
  background: var(--bg-tertiary);
  border-color: var(--focus-ring);
  box-shadow: 0 0 24px var(--focus-glow);
}

.action-btn.danger {
  background: var(--danger);
  color: #ffffff;
}

.action-btn.danger:focus {
  background: var(--danger);
  border-color: #ffffff;
  box-shadow: 0 0 24px rgba(255, 68, 102, 0.5);
}

/* === History === */
.history-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.history-title {
  font-size: 22px;
  font-weight: 600;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.history-list::-webkit-scrollbar {
  width: 4px;
}
.history-list::-webkit-scrollbar-track {
  background: transparent;
}
.history-list::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 2px;
}

.history-section {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 6px 4px 2px;
}

.history-item {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  text-align: left;
  min-height: 56px;
}

.hi-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0a0a0f;
  font-size: 14px;
}

.hi-name {
  font-size: 15px;
  color: var(--text-primary);
}

.hi-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}

.hi-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 80px 20px;
  font-size: 16px;
}

/* === Confirm Delete === */
#confirm-delete {
  justify-content: center;
  align-items: center;
}

.confirm-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.confirm-title {
  font-size: 22px;
  font-weight: 600;
}

.confirm-detail {
  color: var(--text-secondary);
  font-size: 17px;
}
