:root {
  --bg-color: #000000;
  --focus-bg: #243250;
  --text-color: #FFFFFF;
  --accent-color: #4facfe;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

h1 {
  margin-bottom: 2rem;
  font-weight: 300;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
  opacity: 0.8;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

#setup-menu {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.grade-selector {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.grade-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #FFFFFF;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.grade-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.grade-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(79, 172, 254, 0.4);
}

.custom-url-container {
  display: flex;
  gap: 0.5rem;
}

#custom-url {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: #FFFFFF;
  font-size: 0.9rem;
  outline: none;
}

#custom-url:focus {
  border-color: var(--accent-color);
}

#load-custom {
  background: #FFFFFF;
  color: #000000;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
}

#load-custom:hover {
  opacity: 0.8;
}

#focus-area {
  background-color: var(--focus-bg);
  width: 100%;
  padding: 3rem;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#japanese {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.7);
  min-height: 1.5rem;
}

#target {
  font-size: 4rem;
  font-family: var(--font-mono);
  letter-spacing: 0.2em;
  font-weight: 700;
  color: #FFFFFF;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

#target .typed {
  color: rgba(255, 255, 255, 0.3);
}

#start-button {
  background: transparent;
  border: 2px solid #FFFFFF;
  color: #FFFFFF;
  padding: 1rem 3rem;
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 50px;
  transition: all 0.3s ease;
  font-weight: 600;
  letter-spacing: 0.1rem;
}

#start-button:hover {
  background: #FFFFFF;
  color: #243250;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
}

#start-button:active {
  transform: translateY(0);
}

#result {
  margin-top: 1rem;
  font-size: 1.5rem;
  font-weight: 300;
  min-height: 2rem;
}

#japanese.error-text {
  color: #ff4d4d;
  font-weight: 600;
}

/* 遊び心のある演出 */
.playing #focus-area {
  box-shadow: 0 0 60px rgba(79, 172, 254, 0.2);
}

.playing #setup-menu {
  opacity: 0;
  pointer-events: none;
}

.finished #focus-area {
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.02);
  }
}