/* Structured Classes — rank-themed daily path + TraceKanji studio */

.struct-page {
  --struct-accent: #b4783c;
  --struct-accent-soft: rgba(180, 120, 60, 0.14);
  --struct-accent-border: rgba(180, 120, 60, 0.32);
  --struct-accent-glow: rgba(180, 120, 60, 0.22);
  --struct-hero-kanji: '構';
  --struct-fill-grad: linear-gradient(90deg, var(--struct-accent), #e8c080);
  --struct-level-grad: linear-gradient(90deg, var(--struct-accent), #ff9a6b, var(--mint, #00f5d4));
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

.struct-page[data-rank="nomin"] {
  --struct-accent: #b4783c;
  --struct-accent-soft: rgba(180, 120, 60, 0.14);
  --struct-accent-border: rgba(180, 120, 60, 0.32);
  --struct-accent-glow: rgba(180, 120, 60, 0.22);
  --struct-hero-kanji: '農';
  --struct-fill-grad: linear-gradient(90deg, #8b5a2b, #c9a66b);
}

.struct-page[data-rank="samurai"] {
  --struct-accent: #4a90d9;
  --struct-accent-soft: rgba(74, 144, 217, 0.14);
  --struct-accent-border: rgba(74, 144, 217, 0.35);
  --struct-accent-glow: rgba(74, 144, 217, 0.28);
  --struct-hero-kanji: '侍';
  --struct-fill-grad: linear-gradient(90deg, #1e4a7a, #6eb3e8);
}

.struct-page[data-rank="shogun"] {
  --struct-accent: #d4a820;
  --struct-accent-soft: rgba(212, 168, 32, 0.14);
  --struct-accent-border: rgba(212, 168, 32, 0.38);
  --struct-accent-glow: rgba(168, 85, 247, 0.2);
  --struct-hero-kanji: '将';
  --struct-fill-grad: linear-gradient(90deg, #b8860b, #e8c547, #c49bff);
}

.struct-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 50% 42% at 82% 6%, var(--struct-accent-soft), transparent 58%),
    radial-gradient(ellipse 38% 36% at 8% 72%, rgba(0, 245, 212, 0.05), transparent 52%);
}

.struct-page > *:not(.struct-ambient) { position: relative; z-index: 1; }

.struct-hero {
  margin: 0 0 20px;
  padding: 34px 26px 30px;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 58% at 18% 0%, var(--struct-accent-soft), transparent 55%),
    radial-gradient(ellipse 48% 42% at 88% 42%, rgba(0, 245, 212, 0.06), transparent 50%),
    linear-gradient(155deg, #060a12 0%, var(--bg2, #111) 52%, #080610 100%);
  border: 1px solid var(--struct-accent-border);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.42);
}

.struct-hero::before {
  content: var(--struct-hero-kanji);
  position: absolute;
  right: -12px;
  top: -28px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 10rem;
  font-weight: 900;
  color: var(--struct-accent-soft);
  pointer-events: none;
  line-height: 1;
}

.struct-hero-floats {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.struct-hero-floats span {
  position: absolute;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.05);
  animation: structFloat 13s ease-in-out infinite;
}

.struct-hero-floats span:nth-child(1) { left: 6%; top: 18%; font-size: 2.2rem; }
.struct-hero-floats span:nth-child(2) { left: 72%; top: 10%; font-size: 1.7rem; animation-delay: -3s; }
.struct-hero-floats span:nth-child(3) { left: 86%; top: 58%; font-size: 2.8rem; animation-delay: -6s; }
.struct-hero-floats span:nth-child(4) { left: 18%; top: 66%; font-size: 2rem; animation-delay: -9s; }

@keyframes structFloat {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-10px); opacity: 0.85; }
}

.struct-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.struct-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--struct-accent);
  background: var(--struct-accent-soft);
  border: 1px solid var(--struct-accent-border);
  border-radius: 100px;
  padding: 6px 14px;
  margin-bottom: 12px;
}

.struct-hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  line-height: 1.1;
}

.struct-hero-title em {
  font-style: normal;
  background: linear-gradient(90deg, var(--struct-accent), #fff 42%, var(--mint, #00f5d4));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.struct-hero-sub {
  font-size: 0.9rem;
  color: #9a9ab0;
  max-width: 580px;
  line-height: 1.65;
  margin: 0 0 18px;
}

.struct-hero-sub strong { color: #d8dce8; font-weight: 700; }

/* Rank switcher dock */
.struct-rank-dock {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.struct-rank-glider {
  position: absolute;
  top: 6px;
  left: 6px;
  border-radius: 14px;
  background: var(--struct-accent-soft);
  border: 1px solid var(--struct-accent-border);
  box-shadow: 0 8px 24px var(--struct-accent-glow);
  transition: transform 0.32s cubic-bezier(0.34, 1.2, 0.64, 1), width 0.32s ease, height 0.32s ease;
  pointer-events: none;
  z-index: 0;
}

.struct-rank-tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 10px 16px;
  min-width: 108px;
  border: none;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  font-family: 'Space Grotesk', sans-serif;
  transition: color 0.2s;
}

.struct-rank-tab-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  font-weight: 900;
  color: #888;
  line-height: 1.2;
}

.struct-rank-tab-en {
  font-size: 0.68rem;
  font-weight: 800;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.struct-rank-tab-lvl {
  font-size: 0.58rem;
  font-weight: 700;
  color: #555;
}

.struct-rank-tab.active .struct-rank-tab-jp { color: #fff; }
.struct-rank-tab.active .struct-rank-tab-en { color: var(--struct-accent); }
.struct-rank-tab.active .struct-rank-tab-lvl { color: #999; }

.struct-rank-tab--locked { opacity: 0.55; }
.struct-rank-tab--locked .struct-rank-tab-en::after {
  content: ' · Locked';
  font-size: 0.75em;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted, #888);
}

.struct-rank-strip-wrap {
  max-width: 100%;
  margin-bottom: 8px;
}

.struct-rank-strip-wrap .user-rank-strip {
  --rank-color: var(--struct-accent);
  border-color: var(--struct-accent-border);
}

.struct-stat-chip {
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  min-width: 88px;
}

.struct-stat-val {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
  color: #fff;
}

.struct-stat-lbl {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #666;
  margin-top: 2px;
}

.struct-stat-chip--accent .struct-stat-val {
  font-size: 0.82rem;
  color: var(--struct-accent);
}

.struct-level-block--wide { flex: 1; min-width: 200px; }
.struct-daily-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.struct-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #aaa;
}
.struct-pill span.num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--struct-accent-soft);
  color: var(--struct-accent);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.struct-hero-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.struct-level-block {
  min-width: 180px;
}
.struct-level-bar {
  width: 200px;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}
.struct-level-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--struct-level-grad);
  background-size: 200% 100%;
  transition: width 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.struct-stat-label {
  font-size: 0.7rem;
  color: #666;
  margin-bottom: 6px;
}
.struct-stat-bar {
  width: 200px;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}
.struct-stat-fill {
  height: 100%;
  background: var(--struct-fill-grad);
  border-radius: 99px;
  transition: width 0.5s ease;
}
.struct-xp-pill {
  background: var(--struct-accent-soft);
  border: 1px solid var(--struct-accent-border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.82rem;
  color: #f0d080;
  font-weight: 600;
}

.struct-layout {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 280px);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  background: var(--bg2, #111);
}
.struct-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 120px), var(--bg2, #111);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
}
.sidebar-head {
  padding: 18px 14px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  background: linear-gradient(180deg, var(--struct-accent-soft), transparent);
}
.sidebar-rank-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--struct-accent);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--struct-accent-border);
  border-radius: 100px;
  padding: 5px 12px;
  margin-bottom: 12px;
}
.sidebar-avatar-wrap {
  margin: 0 auto 10px !important;
  border-radius: 16px;
  padding: 8px;
  background: radial-gradient(ellipse at 50% 100%, var(--struct-accent-glow), transparent 70%);
  border: 1px solid var(--struct-accent-border);
}
.sidebar-phase-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #777;
  padding: 10px 14px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.sidebar-day-big {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--struct-accent);
  line-height: 1;
}
.sidebar-day-big span {
  font-size: 0.65rem;
  color: #666;
  font-family: 'Space Grotesk', sans-serif;
  display: block;
  letter-spacing: 0.1em;
  margin-top: 4px;
}
.sidebar-rank {
  font-size: 0.72rem;
  color: #888;
  margin-top: 8px;
}
.sidebar-day-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}
.sidebar-day-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-day-item:hover {
  background: var(--struct-accent-soft);
}
.sidebar-day-item.active {
  background: var(--struct-accent-soft);
  border-left-color: var(--struct-accent);
}
.sidebar-day-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #222;
  border: 2px solid #333;
}
.sidebar-day-dot.partial {
  background: #e67e22;
  border-color: #e67e22;
}
.sidebar-day-dot.complete {
  background: var(--mint);
  border-color: var(--mint);
}
.sidebar-day-label {
  font-size: 0.78rem;
  color: #888;
}
.sidebar-day-item.active .sidebar-day-label {
  color: #eee;
  font-weight: 600;
}
.sidebar-day-item.locked-day {
  cursor: not-allowed;
  opacity: 0.45;
}
.sidebar-day-item.locked-day:hover {
  background: transparent;
}
.sidebar-day-dot.locked {
  border-color: #444;
  background: #1a1a1a;
}

.day-unlock-banner {
  display: none;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #c8d0e8;
  background: rgba(0, 245, 212, 0.08);
  border: 1px solid rgba(0, 245, 212, 0.25);
}
.day-unlock-banner.show { display: block; }
.day-unlock-banner strong { color: var(--mint, #00f5d4); }
.day-unlock-banner.warn {
  background: rgba(230, 57, 70, 0.08);
  border-color: rgba(230, 57, 70, 0.3);
  color: #ff8a94;
}

.struct-main {
  flex: 1;
  padding: 28px 32px 48px;
  overflow-y: auto;
}
.struct-day-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.struct-day-badge {
  background: var(--struct-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 20px;
  letter-spacing: 0.1em;
}
.struct-day-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  flex: 1;
}
.struct-step-track {
  display: flex;
  gap: 8px;
  align-items: center;
}
.struct-step-dot {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #555;
  transition: all 0.3s;
}
.struct-step-dot.done {
  background: rgba(0, 245, 212, 0.15);
  border-color: rgba(0, 245, 212, 0.4);
  color: var(--mint);
}
.struct-step-dot.current {
  border-color: var(--struct-accent-border);
  color: var(--struct-accent);
  box-shadow: 0 0 20px var(--struct-accent-glow);
}

.day-welcome-banner {
  background: linear-gradient(135deg, var(--struct-accent-soft), rgba(124, 58, 237, 0.06));
  border: 1px solid var(--struct-accent-border);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.day-welcome-banner h3 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 6px;
}
.day-welcome-banner p {
  color: #888;
  font-size: 0.82rem;
  line-height: 1.6;
  margin: 0;
}

.day-complete-banner {
  display: none;
  background: linear-gradient(135deg, #0c1a10, #0a120c);
  border: 1px solid rgba(0, 245, 212, 0.35);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
  text-align: center;
}
.day-complete-banner.show {
  display: block;
}
.day-complete-banner h3 {
  color: #5ddc90;
  font-size: 1.1rem;
  margin-bottom: 6px;
}
.day-complete-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.day-complete-note {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}

.struct-level-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--struct-accent-border);
  box-shadow: 0 0 24px var(--struct-accent-glow);
}
.struct-level-strip-lv {
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  min-width: 88px;
}
.struct-level-strip-track {
  flex: 1;
  min-width: 140px;
  height: 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.struct-level-strip-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--struct-level-grad);
  background-size: 200% 100%;
  transition: width 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.struct-level-strip-xp {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fbbf24;
  white-space: nowrap;
}
.struct-level-strip-hint {
  width: 100%;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
}

.day-complete-banner p {
  color: #88b898;
  font-size: 0.82rem;
}

.struct-graduation-banner {
  display: none;
  margin-bottom: 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 215, 120, 0.45);
  background: linear-gradient(135deg, rgba(40, 28, 8, 0.95), rgba(18, 14, 8, 0.98));
  padding: 22px 24px;
  box-shadow: 0 0 32px rgba(255, 193, 80, 0.12);
}
.struct-graduation-banner.show {
  display: block;
}
.struct-graduation-inner {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}
.struct-graduation-badge {
  font-family: var(--font-jp, serif);
  font-size: 2.4rem;
  line-height: 1;
  color: #ffd27a;
  text-shadow: 0 0 24px rgba(255, 193, 80, 0.35);
}
.struct-graduation-copy h3 {
  color: #ffe6a8;
  font-size: 1.15rem;
  margin: 0 0 8px;
}
.struct-graduation-copy p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  line-height: 1.65;
  margin: 0 0 6px;
}
.struct-graduation-lv {
  color: #c8f5d8 !important;
}
.struct-graduation-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.struct-graduation-note {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.52);
}

.struct-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}
.struct-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), transparent 40%), var(--bg2, #111);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: 3px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.3s;
}
.struct-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--struct-accent-border);
}
.struct-card[data-step="1"] { border-left-color: #e63939; }
.struct-card[data-step="2"] { border-left-color: #4a90d9; }
.struct-card[data-step="3"] { border-left-color: #e67e22; }
.struct-card[data-step="4"] { border-left-color: #1abc9c; }
.struct-card[data-step="5"] { border-left-color: #9b59b6; }
.struct-card[data-step="6"] { border-left-color: #f0d080; }
.struct-card.learned {
  border-color: rgba(0, 245, 212, 0.35);
}
.struct-card.kanji-card.needs-trace {
  border-color: var(--struct-accent-border);
  box-shadow: 0 0 40px var(--struct-accent-glow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(90deg, var(--struct-accent-soft), rgba(0, 0, 0, 0.2));
}
.card-step-num {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #555;
  margin-right: 10px;
}
.card-type-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.card-learned-badge {
  font-size: 0.65rem;
  color: var(--mint);
  font-weight: 700;
  background: rgba(0, 245, 212, 0.1);
  border-radius: 10px;
  padding: 3px 10px;
  display: none;
}
.struct-card.learned .card-learned-badge {
  display: block;
}
.card-body {
  padding: 22px 20px;
}
.vocab-main {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 8px;
}
.vocab-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: #fff;
}
.vocab-romaji {
  font-size: 0.85rem;
  color: #888;
}
.vocab-en {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ddd;
  margin-bottom: 8px;
}
.card-note {
  font-size: 0.78rem;
  color: #666;
  line-height: 1.6;
}

.kanji-card-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
}
.kanji-char-wrap {
  width: 100px;
  height: 100px;
  background: #080808;
  border: 2px solid var(--struct-accent-border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s, transform 0.2s;
}
.kanji-char-wrap:hover {
  transform: scale(1.03);
  box-shadow: 0 0 32px var(--struct-accent-glow);
}
.kanji-char-wrap.traced {
  border-color: rgba(0, 245, 212, 0.5);
}
.kanji-char {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 3.5rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}
.kanji-char-wrap .trace-pulse {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 2px solid var(--struct-accent-border);
  animation: tracePulse 2s ease infinite;
  pointer-events: none;
}
@keyframes tracePulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.08); }
}
.kanji-en {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.kanji-romaji {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 8px;
}
.kanji-strokes {
  font-size: 0.75rem;
  color: #e67e22;
  font-weight: 600;
  margin-bottom: 12px;
}
.btn-trace-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--struct-accent), color-mix(in srgb, var(--struct-accent) 70%, #000));
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 24px var(--struct-accent-glow);
}
.btn-trace-open:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--struct-accent-glow);
}
.trace-status {
  font-size: 0.72rem;
  color: #888;
  margin-top: 10px;
}
.trace-status.done {
  color: var(--mint);
}

.phrase-jp,
.sentence-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.2rem;
  color: #fff;
  line-height: 1.65;
  margin-bottom: 8px;
}
.phrase-romaji,
.sentence-romaji {
  font-size: 0.78rem;
  color: #777;
  font-style: italic;
  margin-bottom: 6px;
}
.phrase-en {
  font-size: 0.95rem;
  color: #a8d8b0;
  font-weight: 500;
}
.sentence-en {
  font-size: 0.9rem;
  color: #a8a8d8;
  font-weight: 500;
}

/* Sentence write studio */
.sentence-write-modal-box {
  max-width: 960px;
  max-height: calc(100dvh - 32px);
  width: 100%;
  padding: 24px 28px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sentence-write-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}
.sentence-write-footer {
  flex-shrink: 0;
  padding-top: 14px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sentence-write-footer .trace-done-btn {
  margin-top: 0;
  width: 100%;
}
.sentence-write-ref-panel {
  background: rgba(240, 208, 128, 0.08);
  border: 1px solid rgba(240, 208, 128, 0.28);
  border-radius: 14px;
  padding: 14px 18px;
  margin-top: 4px;
}
.sentence-write-ref-text {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.35;
  word-break: break-all;
  letter-spacing: 0.06em;
  text-shadow: 0 0 28px rgba(240, 208, 128, 0.25);
}
.sentence-write-ref-meta {
  font-size: 0.88rem;
  color: #aaa;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.sentence-write-area-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
}
.sentence-write-stage {
  position: relative;
  width: 100%;
  min-height: 240px;
  height: 380px;
  background: #040404;
  border: 2px solid rgba(240, 208, 128, 0.35);
  border-radius: 22px;
  overflow: hidden;
  touch-action: pan-y;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.85), 0 0 40px rgba(240, 208, 128, 0.06);
}
.sentence-write-stage.trace-flash-ok {
  border-color: rgba(0, 245, 212, 0.65);
  box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.25), inset 0 0 80px rgba(0, 0, 0, 0.85);
}
.sentence-write-stage.trace-flash-bad {
  border-color: rgba(230, 57, 70, 0.7);
}
.sentence-write-hint {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.sentence-write-guide {
  position: absolute;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  filter: invert(1) sepia(1) saturate(4) hue-rotate(-10deg) brightness(1.45) drop-shadow(0 0 16px rgba(255, 255, 255, 0.45));
  transition: opacity 0.25s;
}
.sentence-write-guide.hidden {
  opacity: 0 !important;
}
#sw-canvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  z-index: 3;
  touch-action: pan-y;
}
.sentence-write-stage .trace-load-msg {
  font-size: 0.82rem;
  color: #aaa;
  bottom: 16px;
  font-weight: 600;
}
.sentence-write-sidebar {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.sentence-write-sidebar .trace-status-card {
  grid-column: 1 / -1;
}
.sentence-write-sidebar .trace-hint {
  grid-column: 1 / -1;
  font-size: 0.88rem;
}
.sentence-write-sidebar .trace-tools {
  grid-column: 1 / -1;
}
.sentence-write-sidebar .trace-done-btn {
  grid-column: 1 / -1;
}
.sentence-write-box-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f0d080;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.sentence-write-char-big {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: clamp(3.5rem, 10vw, 5rem);
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-align: center;
  padding: 12px 8px 4px;
  text-shadow: 0 0 40px rgba(255, 101, 132, 0.35);
  border-bottom: 2px solid rgba(255, 101, 132, 0.25);
  margin-bottom: 8px;
}
.sentence-write-char {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #d8d0c4;
  margin: 4px 0 10px;
  min-height: 1.3em;
  text-align: center;
}
@media (max-width: 640px) {
  .sentence-write-sidebar {
    grid-template-columns: 1fr;
  }
  .sentence-write-stage {
    min-height: 300px;
    height: 300px;
  }
}
.sentence-card.needs-write {
  border-color: rgba(240, 208, 128, 0.25);
}
.sentence-card .btn-write-open {
  margin-top: 12px;
}

/* Word & phrase practice lab */
.struct-card.needs-practice {
  border-color: color-mix(in srgb, var(--struct-accent) 35%, transparent);
}
.struct-practice {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.15));
  position: relative;
  z-index: 2;
  pointer-events: auto;
}
.struct-practice.done {
  border-color: rgba(0, 245, 212, 0.28);
  background: rgba(0, 245, 212, 0.05);
}
.struct-practice-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--struct-accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.struct-practice-games {
  margin-left: auto;
  color: #c8b4f5;
  text-decoration: none;
  white-space: nowrap;
}
.struct-practice-games:hover {
  color: #fff;
  text-decoration: underline;
}
.struct-practice-grid {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(200px, 1.4fr);
  gap: 14px;
  align-items: stretch;
}
.struct-flip-card {
  position: relative;
  min-height: 148px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  perspective: 800px;
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.struct-flip-card:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
}
.struct-flip-card.is-flipped .struct-flip-front {
  opacity: 0;
  visibility: hidden;
  transform: rotateY(180deg);
  pointer-events: none;
}
.struct-flip-card.is-flipped .struct-flip-back {
  opacity: 1;
  visibility: visible;
  transform: rotateY(0);
  pointer-events: auto;
}
.struct-flip-front,
.struct-flip-back {
  position: absolute;
  inset: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  transition: transform 0.45s ease, opacity 0.35s ease;
  backface-visibility: hidden;
}
.struct-flip-front {
  z-index: 2;
  pointer-events: auto;
}
.struct-flip-back {
  opacity: 0;
  visibility: hidden;
  transform: rotateY(-180deg);
  z-index: 1;
  pointer-events: none;
}
.struct-flip-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}
.struct-flip-en {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}
.struct-flip-r {
  font-size: 0.78rem;
  color: #888;
}
.struct-flip-hint {
  font-size: 0.62rem;
  color: #666;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.struct-hear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #ddd;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  transition: background 0.2s, border-color 0.2s;
}
.struct-hear-btn:hover {
  border-color: var(--struct-accent-border);
  background: var(--struct-accent-soft);
  color: #fff;
}
.struct-quiz-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.struct-quiz-prompt,
.struct-match-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #aaa;
}
.struct-quiz-row {
  display: flex;
  gap: 8px;
}
.struct-quiz-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.88rem;
  font-family: 'Space Grotesk', sans-serif;
}
.struct-quiz-input:focus {
  outline: none;
  border-color: var(--struct-accent-border);
  box-shadow: 0 0 0 2px var(--struct-accent-soft);
}
.struct-quiz-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: var(--struct-accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  white-space: nowrap;
}
.struct-quiz-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.struct-quiz-feedback {
  font-size: 0.74rem;
  font-weight: 700;
  min-height: 1.1em;
}
.struct-quiz-feedback.ok { color: var(--mint); }
.struct-quiz-feedback.fail { color: var(--sakura, #ff6584); }
.struct-match-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.struct-match-opt {
  flex: 1 1 calc(50% - 8px);
  min-width: 120px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #ddd;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  pointer-events: auto;
  touch-action: manipulation;
}
.struct-match-opt:hover:not(:disabled) {
  border-color: var(--struct-accent-border);
  background: var(--struct-accent-soft);
}
.struct-match-opt.picked-ok {
  border-color: rgba(0, 245, 212, 0.5);
  background: rgba(0, 245, 212, 0.12);
  color: var(--mint);
}
.struct-match-opt.picked-bad {
  border-color: rgba(255, 101, 132, 0.5);
  animation: structMatchShake 0.35s ease;
}
@keyframes structMatchShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.struct-practice-status {
  margin-top: 12px;
  font-size: 0.72rem;
  color: #777;
  line-height: 1.45;
}
.struct-practice-status.done {
  color: var(--mint);
  font-weight: 700;
}
@media (max-width: 720px) {
  .struct-practice-grid {
    grid-template-columns: 1fr;
  }
}

.mark-learned-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #ccc;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  transition: all 0.2s;
}
.mark-learned-btn:hover:not(:disabled) {
  background: var(--struct-accent-soft);
  border-color: var(--struct-accent-border);
  color: #fff;
}
.mark-learned-btn[disabled] {
  background: rgba(0, 245, 212, 0.08);
  border-color: rgba(0, 245, 212, 0.3);
  color: var(--mint);
  cursor: default;
}
.mark-learned-btn.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.struct-nav-btns {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.struct-nav-btn {
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #aaa;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  transition: all 0.2s;
}
.struct-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.struct-nav-btn.primary {
  background: var(--struct-accent-soft);
  border-color: var(--struct-accent-border);
  color: var(--struct-accent);
  font-weight: 700;
}
.struct-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Trace studio modal (TraceKanji-inspired) — must sit outside .site-main */
#trace-modal.trace-modal-backdrop,
#sentence-write-modal.trace-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  margin: 0 !important;
  z-index: 9000 !important;
}
.trace-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  z-index: 9000;
  display: none;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
body.flj-modal-open {
  overflow: hidden;
}
.trace-modal-backdrop.open {
  display: block;
}
.trace-modal-backdrop.open .trace-modal-box,
.trace-modal-backdrop.open .sentence-write-modal-box {
  margin: 24px auto;
}
.trace-modal-box {
  background: linear-gradient(160deg, #141414 0%, var(--bg) 100%);
  border: 1px solid rgba(230, 57, 70, 0.35);
  border-radius: 24px;
  padding: 28px;
  max-width: 720px;
  width: 100%;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.8), 0 0 60px rgba(230, 57, 70, 0.1);
  animation: traceModalIn 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes traceModalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: none; }
}
.trace-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.trace-modal-kanji {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 4.5rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 40px rgba(230, 57, 70, 0.3);
}
.trace-modal-en {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}
.trace-modal-info {
  font-size: 0.78rem;
  color: #888;
  margin-top: 4px;
}
.trace-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  color: #aaa;
  font-size: 1rem;
  transition: all 0.2s;
}
.trace-close-btn:hover {
  background: rgba(230, 57, 70, 0.2);
  color: #fff;
}
.trace-area-wrap {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.trace-canvas-container {
  position: relative;
  width: 340px;
  height: 340px;
  background: #060606;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.8);
}
.trace-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.trace-grid-v {
  position: absolute;
  left: 50%;
  top: 8%;
  bottom: 8%;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(230, 57, 70, 0.25), transparent);
}
.trace-grid-h {
  position: absolute;
  top: 50%;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(230, 57, 70, 0.25), transparent);
}
.trace-svg-overlay {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 84%;
  left: 8%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.35;
  z-index: 2;
  filter: invert(1) sepia(1) saturate(3) hue-rotate(-10deg) brightness(1.2);
  transition: opacity 0.3s;
}
.trace-svg-overlay.hidden {
  opacity: 0 !important;
}
#trace-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  z-index: 3;
  touch-action: none;
}
.trace-load-msg {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.68rem;
  color: #555;
  z-index: 4;
  pointer-events: none;
}
.trace-load-msg.trace-msg-err {
  color: #ff8888;
}
.trace-canvas-container.trace-flash-ok {
  box-shadow: 0 0 0 2px rgba(0, 245, 212, 0.6);
}
.trace-canvas-container.trace-flash-bad {
  box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.7);
  animation: trace-shake 0.35s ease;
}
@keyframes trace-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Kana step cards */
.kana-card .kana-main {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
}
.kana-char {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 3.2rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}
.kana-romaji {
  font-size: 1rem;
  color: #888;
}
.kana-review-tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f0d080;
  margin-left: 6px;
}
.sidebar-day-item.review-day .sidebar-day-label {
  color: #c9a86a;
}
.struct-step-dot {
  flex-shrink: 0;
}
.trace-sidebar {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.trace-status-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px 16px 18px;
}
.trace-rep-progress {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.trace-rep-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #d8d0c4;
}
.trace-rep-diff {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}
.trace-rep-diff--easy   { color: #34d399; border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.1); }
.trace-rep-diff--medium { color: #fbbf24; border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.1); }
.trace-rep-diff--hard   { color: #fb923c; border-color: rgba(251, 146, 60, 0.4); background: rgba(251, 146, 60, 0.1); }
.trace-rep-diff--expert { color: #f87171; border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.12); }
.trace-rep-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.trace-rep-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #777;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.trace-rep-dot--done {
  color: #042f1f;
  background: var(--mint, #00f5d4);
  border-color: var(--mint, #00f5d4);
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.35);
}
.trace-rep-dot--current {
  color: #fff;
  border-color: var(--sakura, #ff6584);
  box-shadow: 0 0 0 3px rgba(255, 101, 132, 0.28), 0 0 16px rgba(255, 101, 132, 0.18);
  transform: scale(1.08);
}
.trace-rep-dot--required {
  border-color: rgba(240, 208, 128, 0.55);
}
.trace-rep-dot--optional {
  opacity: 0.72;
}
.trace-optional-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 245, 212, 0.35);
  background: rgba(0, 245, 212, 0.06);
  color: #c8f7ef;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.trace-optional-btn:hover {
  border-color: rgba(0, 245, 212, 0.6);
  color: #ffffff;
}
.trace-stroke-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(230, 57, 70, 0.14);
  border: 1px solid rgba(230, 57, 70, 0.35);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.82rem;
  color: #ff9a9a;
  font-weight: 700;
  transition: all 0.3s;
}
.trace-stroke-badge.done {
  background: rgba(0, 245, 212, 0.14);
  border-color: rgba(0, 245, 212, 0.45);
  color: #6ee7a8;
}
.trace-progress-wrap {
  margin-top: 14px;
}
.trace-progress-label {
  font-size: 0.72rem;
  color: #8a8278;
  margin-bottom: 7px;
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}
.trace-progress-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}
.trace-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), #f59e0b);
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
  width: 0%;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}
.trace-hint {
  font-size: 0.8rem;
  color: #8a8278;
  line-height: 1.7;
  margin: 0;
}
.trace-hint strong {
  color: #d8d0c4;
  font-weight: 700;
}
.trace-tools {
  display: flex;
  gap: 8px;
}
.trace-tool {
  flex: 1;
  padding: 12px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #b0a89e;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  font-family: 'Space Grotesk', sans-serif;
  transition: all 0.18s;
}
.trace-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  transform: translateY(-1px);
}
.trace-tool:active {
  transform: translateY(0);
}
.trace-done-btn {
  padding: 15px;
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.22), rgba(0, 245, 212, 0.08));
  border: 1px solid rgba(0, 245, 212, 0.45);
  border-radius: 14px;
  color: #6ee7a8;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  transition: all 0.25s;
  margin-top: auto;
}
.trace-done-btn:not(:disabled) {
  animation: traceDonePulse 2.2s ease-in-out infinite;
}
.trace-done-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.34), rgba(0, 245, 212, 0.16));
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 245, 212, 0.28);
}
.trace-done-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: #7a7268;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
@keyframes traceDonePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 245, 212, 0); }
  50% { box-shadow: 0 0 0 5px rgba(0, 245, 212, 0.12); }
}

@media (max-width: 768px) {
  .struct-page { padding: 0 12px 32px; }
  .struct-hero { padding: 24px 18px; border-radius: 18px; }
  .struct-rank-dock { width: 100%; }
  .struct-rank-tab { flex: 1; min-width: 0; align-items: center; text-align: center; }
  .struct-layout {
    flex-direction: column;
    border-radius: 18px;
  }
  .struct-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .sidebar-day-list {
    display: flex;
    overflow-x: auto;
    flex-direction: row;
    padding: 8px;
    gap: 4px;
  }
  .sidebar-day-item {
    flex-direction: column;
    min-width: 52px;
    padding: 8px;
    text-align: center;
    border-left: none;
    border-bottom: 3px solid transparent;
  }
  .sidebar-day-item.active {
    border-bottom-color: var(--struct-accent);
  }
  .struct-main {
    padding: 18px 16px;
  }
  .trace-area-wrap {
    flex-direction: column;
    align-items: center;
  }
  .trace-canvas-container {
    width: min(100%, 300px);
    height: min(100vw, 300px);
  }
}
