.page-practice {
  min-height: 100vh;
  background: linear-gradient(180deg, #fefefe 0%, #f7f8ff 38%, #f7fbff 100%);
  padding-bottom: 2rem;
}

.practice-main {
  flex: 1;
}

.practice-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  padding-top: 2rem;
  padding-bottom: 1.25rem;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.practice-utility-row {
  width: min(100%, 760px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-like {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(103, 116, 176, 0.14);
  padding: 0.7rem 0.85rem;
}

.practice-progress {
  flex: 1;
}

.practice-progress-text {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #586395;
}

.practice-progress-track {
  margin-top: 0.4rem;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #eef1ff;
  overflow: hidden;
}

.practice-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b9bff 0%, #62a4ff 100%);
  transition: width 0.25s ease;
}

.btn-continue {
  min-width: 6.5rem;
}

.btn.is-press {
  animation: microPress 180ms ease;
}

@keyframes microPress {
  0% { transform: scale(1); }
  50% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

.theme-toggle-btn {
  margin-left: auto;
  padding: 0.35rem 0.8rem;
  border-radius: 10px;
  background: #f2f5ff;
  color: #45518e;
  font-size: 0.75rem;
  font-weight: 700;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 20, 40, 0.55);
  padding: 1rem;
}

.onboarding-overlay[hidden] {
  display: none;
}

.onboarding-card {
  width: min(92vw, 420px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.25);
  padding: 1.2rem 1rem;
  text-align: center;
}

.onboarding-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.onboarding-card p {
  margin: 0.7rem 0 0.9rem;
  color: #5b6482;
  line-height: 1.65;
}

.toast-container {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-item {
  min-width: 170px;
  max-width: 300px;
  background: #1f2947;
  color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  padding: 0.62rem 0.78rem;
  font-size: 0.82rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-item.is-show {
  opacity: 1;
  transform: translateY(0);
}

.loading-indicator {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 125;
  background: #ffffff;
  color: #445087;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(42, 50, 90, 0.2);
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.theme-dark.page-practice {
  background: linear-gradient(180deg, #121522 0%, #171d31 42%, #151d2e 100%);
}

.theme-dark .practice-char-display,
.theme-dark .practice-canvas-area > .canvas-stack,
.theme-dark .practice-actions-inner,
.theme-dark .card-like {
  background: #1e263b;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.theme-dark .practice-char-text {
  color: #e4ebff;
}

.theme-dark .practice-char-label,
.theme-dark .practice-progress-text {
  color: #b8c4f2;
}

.theme-dark .practice-progress-track {
  background: #2d3757;
}

.theme-dark .theme-toggle-btn {
  background: #2c3553;
  color: #d5deff;
}

.theme-dark .onboarding-card,
.theme-dark .loading-indicator {
  background: #1e263b;
  color: #dbe5ff;
}

.theme-dark .onboarding-card p {
  color: #bcc9ef;
}

.practice-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.practice-char-display {
  width: min(100%, 760px);
  text-align: center;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(93, 106, 164, 0.16);
  padding: 1.1rem 1rem 1.2rem;
}

.practice-char-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #8691ba;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.practice-char-text {
  font-size: clamp(5.4rem, 20vw, 9rem);
  font-weight: 800;
  line-height: 1;
  margin: 0;
  color: #3f4f8f;
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  user-select: none;
}

.practice-char-romaji {
  margin: 0.45rem 0 0;
  font-size: clamp(0.82rem, 2.6vw, 0.98rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: #97a0c2;
  text-transform: lowercase;
}

.practice-canvas-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.practice-canvas-area > .canvas-stack {
  width: 100%;
  max-width: 760px;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: 0 18px 42px rgba(104, 119, 178, 0.2);
}

.practice-guide-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.practice-guide-char {
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1;
  font-size: clamp(7rem, 42vmin, 14rem);
  color: #7c8ee0;
  opacity: 0.2;
  user-select: none;
}

.stroke-animation-root {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.practice-canvas-area .practice-canvas {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 560 / 320;
  vertical-align: top;
  touch-action: none;
}

.practice-canvas-stack--disabled {
  opacity: 0.65;
  pointer-events: none;
}

.practice-canvas-stack--disabled .practice-canvas {
  touch-action: auto;
}

.practice-actions-bar .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.practice-actions-bar {
  position: static;
  width: 100%;
  margin-top: 0.85rem;
}

.practice-actions-inner {
  display: block;
  width: min(100%, 760px);
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  padding: 0.9rem 0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(100, 112, 168, 0.14);
}

.practice-actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 0.75rem;
}

.practice-actions-bar .btn {
  min-width: 8.75rem;
  border: 0;
  border-radius: 14px;
  padding: 0.72rem 1.15rem;
  box-shadow: 0 8px 18px rgba(82, 93, 153, 0.14);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.page-practice .btn:hover,
.page-practice .btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(82, 93, 153, 0.18);
  outline: none;
}

.page-practice .btn-primary {
  background: linear-gradient(135deg, #9ba9ff 0%, #8bb8ff 100%);
  color: #ffffff;
}

.page-practice .btn-secondary {
  background: #f2f5ff;
  color: #4b598f;
}

@media (max-width: 768px) {
  .practice-inner {
    padding-top: 1.25rem;
  }

  .practice-char-display,
  .practice-canvas-area > .canvas-stack,
  .practice-actions-inner {
    width: 100%;
  }

  .practice-utility-row {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .practice-char-display {
    padding: 0.9rem 0.75rem 1rem;
    border-radius: 14px;
  }

  .practice-actions-inner {
    border-radius: 14px;
    padding: 0.75rem;
  }

  .practice-actions-bar .btn {
    min-width: 7.8rem;
  }
}
