:root {
  --font-current: 'Cinzel', serif;
  --transition-theme: background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg-color: #070709;
  --text-color: #f5f5f7;
  --ui-bg: rgba(20, 20, 26, 0.65);
  --ui-border: rgba(255, 255, 255, 0.12);
  --ui-hover: rgba(255, 255, 255, 0.16);
  --ui-active: rgba(255, 255, 255, 0.22);
  --ring-bg: rgba(255, 255, 255, 0.1);
  --ring-fg: #f5f5f7;
  --shadow-subtle: 0 12px 36px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-color: #f7f7f9;
  --text-color: #0b0b0e;
  --ui-bg: rgba(255, 255, 255, 0.7);
  --ui-border: rgba(0, 0, 0, 0.09);
  --ui-hover: rgba(0, 0, 0, 0.08);
  --ui-active: rgba(0, 0, 0, 0.14);
  --ring-bg: rgba(0, 0, 0, 0.08);
  --ring-fg: #0b0b0e;
  --shadow-subtle: 0 12px 36px rgba(0, 0, 0, 0.1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition-theme);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.word {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-family: var(--font-current);
  font-size: clamp(2.4rem, 7.8vw, 6.8rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--text-color);
  pointer-events: none;
  transition: color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.letter {
  display: inline-block;
  position: relative;
  will-change: transform;
  transform-origin: center center;
  pointer-events: auto;
  cursor: grab;
  padding: 0.15em 0.04em;
  transition: color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.letter:active {
  cursor: grabbing;
}

.controls {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  padding: 6px;
  border-radius: 999px;
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-theme), border-color 0.3s ease;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-color);
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background-color: var(--ui-hover);
  transform: scale(1.06);
}

.icon-btn:active {
  background-color: var(--ui-active);
  transform: scale(0.95);
}

.btn-icon {
  display: block;
  pointer-events: none;
}

[data-theme="dark"] .theme-moon {
  display: none;
}

[data-theme="light"] .theme-sun {
  display: none;
}

.progress-ring {
  position: absolute;
  top: 1px;
  left: 1px;
  transform: rotate(-90deg);
  pointer-events: none;
}

.ring-bg {
  fill: transparent;
  stroke: var(--ring-bg);
  stroke-width: 2.2;
}

.ring-fg {
  fill: transparent;
  stroke: var(--ring-fg);
  stroke-width: 2.2;
  stroke-dasharray: 87.96;
  stroke-dashoffset: 87.96;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.05s linear;
}

.play-pause-icon {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.icon-play {
  display: none;
}

.icon-btn:hover .play-pause-icon,
.icon-btn.is-paused .play-pause-icon {
  opacity: 0.85;
}

.icon-btn.is-paused .icon-pause {
  display: none;
}

.icon-btn.is-paused .icon-play {
  display: block;
}

@media (max-width: 640px) {
  .controls {
    top: 14px;
    right: 14px;
    padding: 4px;
    gap: 6px;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
  }
}
