: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;
  -webkit-user-select: none;
  user-select: none;
}

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

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

.screen.hidden {
  display: none !important;
}

.screen-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

/* Header & Title */
.header {
  width: 100%;
  text-align: center;
  padding: 10px 0;
  border-bottom: 2px solid var(--bg-tertiary);
}

.title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.subtitle {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Menu Container */
.menu-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
}

/* Buttons */
.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);
}

.btn-primary,
.btn-secondary {
  padding: 16px 24px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: #000;
}

.btn-primary:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--focus-glow), 0 0 8px var(--accent);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--bg-tertiary);
}

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

/* Footer Text */
.footer-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: auto;
}

/* Modal Box */
.modal-box {
  background: var(--bg-secondary);
  border: 2px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 30px;
  width: 100%;
  max-width: 450px;
  text-align: center;
}

.modal-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--accent);
}

/* Game Screen */
.game-top {
  display: flex;
  gap: 16px;
  width: 100%;
  padding: 8px 0;
  justify-content: space-between;
  align-items: flex-start;
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--bg-tertiary);
}

.info-row {
  display: flex;
  gap: 8px;
  font-size: 14px;
}

.info-label {
  color: var(--text-secondary);
}

.info-value {
  color: var(--accent);
  font-weight: 600;
}

.next-piece {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 2px solid var(--bg-tertiary);
}

.next-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

#next-canvas {
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 4px;
  width: 80px;
  height: 80px;
}

/* Game Canvas */
.game-canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#game-canvas {
  background: var(--bg-primary);
  border: 2px solid var(--accent);
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

/* Game Controls */
.game-controls {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.game-controls .btn-secondary {
  min-width: 150px;
}

/* Score Display */
.score-display {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 20px 0;
  width: 100%;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-tertiary);
}

.score-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.score-number {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
}

/* Instructions Box */
.instructions-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 450px;
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  padding-bottom: 16px;
}

.instruction-item {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.instruction-item strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

/* Settings Box */
.settings-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 450px;
  margin: 20px 0;
}

.setting-item {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 2px solid var(--bg-tertiary);
}

.setting-item label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  min-height: 60px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: var(--radius-md);
}

.setting-item label:focus {
  background: var(--bg-tertiary);
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}

.setting-label {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
}

.toggle-indicator {
  padding: 4px 12px;
  background: var(--accent);
  color: #000;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.toggle-indicator.off {
  background: var(--text-muted);
  color: var(--text-primary);
}

/* Scrollbar styling for instructions */
.instructions-box::-webkit-scrollbar {
  width: 4px;
}

.instructions-box::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.instructions-box::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 2px;
}

.instructions-box::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
