* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1c1f26;
  color: #f1f3f5;
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.app {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

h1 {
  font-size: 2.5rem;
  margin: 0 0 4px;
  letter-spacing: 0.05em;
}

.subtitle {
  color: #9aa4b2;
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.mode-switch {
  margin-bottom: 20px;
}

.mode-switch button {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #333a45;
  background: #262b34;
  color: #9aa4b2;
  font-size: 0.8rem;
  cursor: pointer;
}

.mode-switch button:hover {
  background: #313846;
  color: #f1f3f5;
}

.tiles-wrap {
  position: relative;
  margin-bottom: 24px;
}

.tiles {
  display: flex;
  gap: 12px;
  justify-content: center;
  min-height: 64px;
}

.start-overlay {
  position: absolute;
  inset: 0;
  border: none;
  border-radius: 12px;
  background: #22c55e;
  color: #08130c;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
}

.start-overlay:hover {
  background: #16a34a;
}

.start-overlay[hidden] {
  display: none;
}

.tile {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(160deg, #3b82f6, #2563eb);
  color: #f1f3f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.tile:hover:not(:disabled) {
  transform: translateY(-2px);
}

.tile:disabled,
.tile.used {
  background: #2b2f38;
  color: #6b7280;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.tile.selected {
  background: linear-gradient(160deg, #f59e0b, #d97706);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
}

.pad {
  margin-bottom: 16px;
}

.pad-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.pad-row button {
  min-width: 48px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #333a45;
  background: #262b34;
  color: #f1f3f5;
  font-size: 1.1rem;
  cursor: pointer;
}

.pad-row button:hover:not(:disabled) {
  background: #313846;
}

.pad-row button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pad-row button.selected {
  background: #d97706;
  border-color: #d97706;
  color: #08130c;
  opacity: 1;
}

#expression {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.1rem;
  border-radius: 8px;
  border: 1px solid #333a45;
  background: #12151a;
  color: #f1f3f5;
  margin-bottom: 16px;
  text-align: center;
}

#expression:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tile-hint {
  min-height: 1.3em;
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: #9aa4b2;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.actions button {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #333a45;
  background: #262b34;
  color: #f1f3f5;
  cursor: pointer;
  font-size: 0.95rem;
}

.actions button:hover:not(:disabled) {
  background: #313846;
}

.actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.actions .primary {
  background: #22c55e;
  border-color: #22c55e;
  color: #08130c;
  font-weight: 600;
}

.actions .primary:hover:not(:disabled) {
  background: #16a34a;
}

.actions .primary:disabled {
  background: #22c55e;
}

.timer {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #9aa4b2;
  font-variant-numeric: tabular-nums;
}

.message {
  min-height: 1.4em;
  font-weight: 600;
}

.message.success {
  color: #4ade80;
}

.message.error {
  color: #f87171;
}

.message.info {
  color: #60a5fa;
}
