:root {
  --bg: #0a0a0f;
  --surface: #14141f;
  --border: #2a2a3a;
  --pink: #ff2d78;
  --cyan: #00e5ff;
  --gold: #ffd700;
  --green: #39ff14;
  --text: #e8e8f0;
  --text-dim: #8888aa;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* Header */
.header {
  text-align: center;
  padding: 20px 0 8px;
  width: 100%;
}

.title {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.title-en {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.subtitle-en {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Score Bar */
.score-bar {
  display: flex;
  gap: 32px;
  justify-content: center;
  padding: 12px 0;
  width: 100%;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.score-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.score-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}

/* Game Area */
.game-area {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.simon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(90vw, 360px);
  aspect-ratio: 1;
}

/* Panels */
.simon-panel {
  border: none;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: filter 0.1s, transform 0.1s, box-shadow 0.1s;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.simon-panel:disabled {
  cursor: default;
  opacity: 0.5;
}

.simon-panel:not(:disabled):active {
  transform: scale(0.95);
}

.panel-emoji {
  font-size: 2.2rem;
  line-height: 1;
  pointer-events: none;
}

.panel-label {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Panel Colors */
.panel-pink {
  background: var(--pink);
  box-shadow: 0 4px 20px rgba(255, 45, 120, 0.3);
}

.panel-cyan {
  background: var(--cyan);
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.3);
}

.panel-gold {
  background: var(--gold);
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.panel-green {
  background: var(--green);
  box-shadow: 0 4px 20px rgba(57, 255, 20, 0.3);
}

/* Panel Active / Lit States */
.panel-pink.active {
  filter: brightness(1.8);
  box-shadow: 0 0 40px rgba(255, 45, 120, 0.8), 0 0 80px rgba(255, 45, 120, 0.4);
}

.panel-cyan.active {
  filter: brightness(1.8);
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.8), 0 0 80px rgba(0, 229, 255, 0.4);
}

.panel-gold.active {
  filter: brightness(1.8);
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 80px rgba(255, 215, 0, 0.4);
}

.panel-green.active {
  filter: brightness(1.8);
  box-shadow: 0 0 40px rgba(57, 255, 20, 0.8), 0 0 80px rgba(57, 255, 20, 0.4);
}

/* Status Message */
.status-message {
  font-size: 0.95rem;
  color: var(--text-dim);
  text-align: center;
  padding: 8px 0;
  min-height: 2em;
  transition: color 0.3s;
}

/* Start Button */
.btn-start {
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 48px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 3px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(255, 45, 120, 0.4);
  margin: 8px 0;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(255, 45, 120, 0.6);
}

.btn-start:active {
  transform: scale(0.96);
}

.btn-start.hidden {
  display: none;
}

/* Game Over Overlay */
.game-over-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}

.game-over-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.game-over-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px 28px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.4s;
}

.game-over-overlay.visible .game-over-card {
  transform: scale(1);
}

.game-over-title {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.game-over-round {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.6;
}

.game-over-round-en {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.game-over-best {
  font-size: 0.95rem;
  color: var(--gold);
  margin-bottom: 20px;
}

.game-over-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.btn-retry,
.btn-share {
  border: none;
  border-radius: 50px;
  padding: 12px 24px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-retry {
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  color: #fff;
}

.btn-share {
  background: #1da1f2;
  color: #fff;
}

.btn-retry:hover,
.btn-share:hover {
  transform: translateY(-2px);
}

.patreon-cta {
  display: inline-block;
  background: linear-gradient(135deg, #ff424d, #f96854);
  color: #fff;
  text-decoration: none;
  border-radius: 50px;
  padding: 12px 24px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(255, 66, 77, 0.3);
}

.patreon-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255, 66, 77, 0.5);
}

/* Milestone Popup */
.milestone-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 24px 36px;
  z-index: 90;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.milestone-popup.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.milestone-text {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold);
  white-space: nowrap;
}

/* How to Play */
.how-to-play {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin: 20px 0;
  overflow: hidden;
}

.how-to-play summary {
  padding: 14px 20px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.how-to-play summary::before {
  content: '▶';
  font-size: 0.7rem;
  transition: transform 0.3s;
}

.how-to-play[open] summary::before {
  transform: rotate(90deg);
}

.how-to-content {
  padding: 0 20px 16px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.8;
}

.how-to-content p {
  margin: 12px 0 4px;
}

.how-to-content ol {
  padding-left: 20px;
}

/* Footer */
.footer {
  padding: 20px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  width: 100%;
}

.footer a {
  color: var(--pink);
  text-decoration: none;
  font-weight: 600;
}

.footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 400px) {
  .title {
    font-size: 1.6rem;
  }

  .simon-grid {
    gap: 8px;
  }

  .panel-emoji {
    font-size: 1.8rem;
  }

  .panel-label {
    font-size: 0.7rem;
  }

  .score-value {
    font-size: 1.6rem;
  }
}

@media (min-width: 600px) {
  .simon-grid {
    width: 380px;
  }
}
