* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #38bdf8;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.canvas-wrapper {
  width: 1280px;
  height: 720px;
  min-width: 1280px;
  min-height: 720px;
  position: relative;
  background: url('assets/bg.png') no-repeat center center;
  background-size: 100% 100%;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.2);
  transform-origin: center center;
  overflow: hidden;
}

.top-left-bar {
  position: absolute;
  top: 16px;
  left: 18px;
  z-index: 50;
}

.setting-btn {
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #0369a1;
  border: 2px solid rgba(255, 255, 255, 0.95);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}

.setting-btn:hover {
  transform: scale(1.06);
  background: #ffffff;
}

.header-banner {
  position: absolute;
  left: 150px;
  top: 18px;
  width: 900px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  z-index: 15;
  pointer-events: none;
}

.eyebrow-badge {
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #0284c7;
  font-size: 13px;
  font-weight: 800;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.2);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.main-title {
  font-size: 42px;
  font-weight: 900;
  color: #fff12b;
  letter-spacing: 2px;
  text-shadow: -2px -2px 0 #0284c7, 2px -2px 0 #0284c7, -2px 2px 0 #0284c7, 2px 2px 0 #0284c7, 0 5px 0 #0369a1, 0 8px 16px rgba(0, 0, 0, 0.25);
  margin-bottom: 6px;
}

.instruction-pill {
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border-left: 4px solid #f59e0b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.wheel-stage {
  position: absolute;
  left: 511.5px;
  top: 405px;
  width: 461px;
  height: 461px;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.wheel-container {
  width: 100%;
  height: 100%;
  position: absolute;
  cursor: pointer;
}

.wheel-img {
  width: 100%;
  height: 100%;
  display: block;
  transform-origin: 50% 50%;
  will-change: transform;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.16));
}

.pointer-container {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 116px;
  height: 147px;
  transform: translate(-50%, -59.9%);
  transform-origin: 50% 59.9%;
  cursor: pointer;
  z-index: 20;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
  will-change: transform;
}

.pointer-container.wobble {
  animation: needleFlick 0.08s ease-out;
}

@keyframes needleFlick {
  0% { transform: translate(-50%, -59.9%) rotate(0deg); }
  35% { transform: translate(-50%, -59.9%) rotate(5deg); }
  100% { transform: translate(-50%, -59.9%) rotate(0deg); }
}

.pointer-img {
  width: 100%;
  height: 100%;
  display: block;
}

.action-btn {
  position: absolute;
  left: 832px;
  top: 362px;
  width: 188px;
  height: 86px;
  background: url('assets/button.png') no-repeat center center;
  background-size: 100% 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 30;
  transition: transform 0.15s ease, filter 0.15s ease;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
}

.action-btn:hover {
  transform: scale(1.05);
}

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

.action-btn.pulse {
  animation: btnPulse 1.2s infinite ease-in-out;
}

@keyframes btnPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 6px 12px rgba(255, 100, 0, 0.3)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 10px 22px rgba(255, 60, 0, 0.55)); }
}

.btn-text {
  font-size: 26px;
  font-weight: 900;
  color: #ff1e27;
  letter-spacing: 2px;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8), 0 2px 4px rgba(180, 0, 0, 0.25);
}

.top-bar {
  position: absolute;
  top: 16px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 50;
}

.tool-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  font-size: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.tool-btn:hover {
  transform: scale(1.1);
  background: #ffffff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: 540px;
  background: #ffffff;
  border-radius: 32px;
  padding: 36px 36px 32px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  border: 4px solid #fed330;
  transform: scale(0.85);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-tag {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 10px;
}

.question-title {
  font-size: 18px;
  color: #64748b;
  font-weight: 700;
}

.result-name {
  font-size: 64px;
  font-weight: 900;
  color: #e11d48;
  margin: 6px 0 16px;
  letter-spacing: 4px;
  text-shadow: 0 4px 12px rgba(225, 29, 72, 0.2);
}

.answer-box {
  background: #f8fafc;
  border-radius: 20px;
  border: 2px dashed #cbd5e1;
  padding: 20px;
  margin-bottom: 24px;
}

.reveal-btn {
  padding: 13px 32px;
  font-size: 18px;
  font-weight: 800;
  color: #1d4ed8;
  background: #bfdbfe;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.reveal-btn:hover {
  transform: scale(1.05);
  background: #93c5fd;
}

.answer-revealed {
  display: none;
}

.answer-box.revealed .answer-hidden {
  display: none;
}

.answer-box.revealed .answer-revealed {
  display: block;
}

.word-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.result-word {
  font-size: 34px;
  font-weight: 900;
  color: #0284c7;
}

.result-phonetic {
  font-size: 18px;
  color: #64748b;
  font-family: monospace;
}

.result-sentence {
  font-size: 16px;
  color: #334155;
  font-style: italic;
  font-weight: 500;
}

.close-btn {
  padding: 14px 48px;
  font-size: 20px;
  font-weight: 900;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
  transition: transform 0.15s ease;
}

.close-btn:hover {
  transform: scale(1.04);
}

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

.setting-card {
  width: 620px;
  background: #ffffff;
  border-radius: 28px;
  padding: 28px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  border: 3px solid #38bdf8;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.setting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.setting-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.close-x-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.setting-hint {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 14px;
}

.items-list {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 6px;
  margin-bottom: 16px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.item-idx {
  font-weight: 800;
  color: #94a3b8;
  font-size: 13px;
  width: 20px;
}

.item-input {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  outline: none;
}

.item-input:focus {
  border-color: #38bdf8;
}

.input-ch { width: 90px; font-weight: 700; }
.input-en { width: 120px; }
.input-phonetic { width: 100px; font-family: monospace; }
.input-sentence { flex: 1; }

.del-btn {
  background: #fee2e2;
  color: #ef4444;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}

.del-btn:hover {
  background: #fecaca;
}

.setting-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.action-pill-btn {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.action-pill-btn:hover { transform: scale(1.04); }
.add-btn { background: #e0f2fe; color: #0284c7; }
.reset-btn { background: #f1f5f9; color: #64748b; }
.save-btn { background: #0284c7; color: #ffffff; }
