.grammar-dashboard-page {
  --grammar-ink: #0a1b50;
  --grammar-muted: #7085aa;
  color: var(--grammar-ink);
  background: radial-gradient(ellipse at 12% 16%, #d9edff 0%, transparent 48%), linear-gradient(145deg, #edf7ff, #f8fbff 65%, #eef8ff);
}

.grammar-dashboard-page .grammar-dashboard-shell { width: min(1380px, calc(100% - 30px)); padding: 14px 0 24px; }
.grammar-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.grammar-dashboard-page svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.grammar-dashboard-page .grammar-symbols { width: 0; height: 0; }
.grammar-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 80px; margin-bottom: 26px; padding: 14px 20px; border-radius: 20px; background: rgba(255, 255, 255, .88); }
.grammar-brand { display: flex; align-items: center; gap: 12px; color: var(--grammar-ink); text-decoration: none; }
.grammar-brand strong { display: block; font-size: 20px; font-weight: 750; line-height: 1.35; }
.grammar-brand small { display: block; color: var(--grammar-muted); font-size: .92rem; }
.grammar-brand__icon { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid #d1e2ff; border-radius: 50%; color: #3d7dff; background: #eaf4ff; box-shadow: inset 0 0 0 5px #f3f9ff; }
.grammar-back { display: inline-flex; align-items: center; gap: 8px; padding: 13px 20px; border-radius: 32px; background: #eef5ff; color: #3478ff; font-weight: 700; text-decoration: none; box-shadow: 0 8px 22px #b4d0f330; }
.grammar-dashboard { display: grid; gap: 26px; }
.grammar-hero { position: relative; display: flex; align-items: center; min-height: 364px; padding: 34px; overflow: hidden; border-radius: 22px; background: linear-gradient(90deg, #f1faff 0%, #eff9fff0 25%, #eaf7ff9c 43%, transparent 65%), url('../../../assets/jlpt-vocab-hero-v2.webp') center / cover no-repeat; }
.grammar-hero__copy { position: relative; z-index: 1; }
.grammar-eyebrow { margin: 0 0 14px; color: #397bff; font-size: 13px; font-weight: 750; letter-spacing: .24em; }
.grammar-hero h1 { margin: 0; color: #09194c; font-size: clamp(34px, 4.8vw, 60px); font-weight: 900; letter-spacing: -.045em; line-height: 1.23; }
.grammar-hero h1 span { color: #2869ff; }
.grammar-hero__description { margin: 18px 0; color: #5c77a0; font-size: 18px; line-height: 1.65; }
.grammar-hero__tags { display: flex; flex-wrap: wrap; gap: 12px; }
.grammar-hero__tags span { padding: 7px 20px; border: 1px solid #d5e4ff; border-radius: 24px; background: #ffffffed; color: #3075ff; font-size: .92rem; font-weight: 650; box-shadow: 0 5px 14px #8bb6ed12; }
.grammar-hero__bubble { position: absolute; top: 48px; right: 8%; padding: 14px 19px; border-radius: 24px; background: #fffffff2; color: #3779ff; font-size: 17px; font-weight: 750; line-height: 1.4; transform: rotate(-9deg); box-shadow: 0 8px 20px #8bb6ed22; }
.grammar-hero__bubble::after { content: ''; position: absolute; left: 30px; bottom: -10px; border: 12px solid transparent; border-top-color: #fffffff2; border-bottom: 0; }
.grammar-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 22px 12px; min-height: 158px; background: #ffffffed; border-radius: 20px; }
.grammar-stat { display: flex; gap: 18px; padding: 4px 14px; min-width: 0; }
.grammar-stat + .grammar-stat { border-left: 1px solid #deebfc; }
.grammar-stat__icon { display: grid; place-items: center; flex-shrink: 0; width: 56px; height: 56px; margin-top: 2px; border-radius: 50%; font-size: 27px; font-weight: 700; color: var(--card-color); background: var(--card-tint); }
.grammar-stat__label { color: var(--grammar-muted); font-size: .92rem; }
.grammar-stat strong { display: block; font-size: 32px; line-height: 1.2; font-weight: 750; margin: 2px 0 4px; }
.grammar-stat p { margin: 0; color: var(--grammar-muted); font-size: 14px; line-height: 1.5; }
.grammar-stat--blue, .grammar-mode--blue { --card-color: #4a83ff; --card-tint: #eaf2ff; --card-border: #deebff; }
.grammar-stat--pink, .grammar-mode--pink { --card-color: #ff6681; --card-tint: #fff0f3; --card-border: #ffe3e9; }
.grammar-mode--purple { --card-color: #9160ff; --card-tint: #f3edff; --card-border: #ede5ff; }
.grammar-stat--green, .grammar-mode--green { --card-color: #21c4a0; --card-tint: #e9faf4; --card-border: #daf5ee; }
.grammar-stat--orange { --card-color: #ffac32; --card-tint: #fff5e6; }
.grammar-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grammar-control { min-width: 0; min-height: 170px; padding: 22px 24px; background: #ffffffed; border: 1px solid #e7f0ff; border-radius: 20px; box-shadow: 0 12px 26px #aacbf412; }
.grammar-control__heading { display: flex; align-items: center; gap: 16px; }
.grammar-control__icon { display: grid; place-items: center; flex-shrink: 0; width: 46px; height: 46px; color: #fff; border-radius: 13px; background: linear-gradient(135deg, #70a9ff, #2c70ff); box-shadow: 0 8px 14px #4c88ff30; }
.grammar-control__icon svg { width: 23px; height: 23px; }
.grammar-control h2 { margin: 0; font-size: 21px; font-weight: 750; line-height: 1.4; }
.grammar-control__heading p { margin: 2px 0 0; color: var(--grammar-muted); font-size: 14px; line-height: 1.45; }
.grammar-control__heading > a { margin-left: auto; color: #387cff; text-decoration: none; font-size: 14px; font-weight: 650; white-space: nowrap; }
.grammar-levels { display: flex; gap: 9px; margin-top: 19px; }
.grammar-levels button { flex: 1; min-width: 0; min-height: 44px; padding: 7px; border: 1px solid #c9dcff; border-radius: 26px; background: #fafdff; color: #314d85; font: inherit; cursor: pointer; }
.grammar-levels button[aria-pressed='true'] { color: #fff; font-weight: 700; border-color: #377bff; background: linear-gradient(120deg, #548bff, #2468ff); box-shadow: 0 7px 15px #3477ee35; }
.grammar-levels button:disabled { color: #8091b0; cursor: not-allowed; }
.grammar-progress { display: flex; align-items: center; gap: 16px; margin-top: 23px; }
.grammar-progress__track { flex: 1; height: 14px; overflow: hidden; border-radius: 20px; background: #e7effd; }
.grammar-progress__track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #609eff, #397aff); transition: width 220ms ease; }
.grammar-progress > strong { min-width: 56px; text-align: right; font-size: 19px; line-height: 1; }
.grammar-progress__caption { margin: 13px 0 0; font-size: 16px; color: var(--grammar-muted); }
.grammar-modes { margin-top: 6px; }
.grammar-modes__heading { display: flex; align-items: center; gap: 17px; margin-bottom: 12px; }
.grammar-modes__heading > svg { color: #5890ff; }
.grammar-modes h2 { margin: 0; font-size: 25px; font-weight: 750; line-height: 1.4; }
.grammar-modes__heading p { margin: 0; color: var(--grammar-muted); font-size: 16px; }
.grammar-mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.grammar-mode { position: relative; display: flex; align-items: flex-start; gap: 18px; min-width: 0; min-height: 198px; padding: 23px 24px 60px; border: 1px solid var(--card-border); border-radius: 19px; color: var(--grammar-ink); text-decoration: none; background: linear-gradient(125deg, #fff 20%, color-mix(in srgb, var(--card-tint) 55%, white)); box-shadow: 0 10px 25px #b6d1f218; transition: transform 160ms ease, box-shadow 160ms ease; }
.grammar-mode:hover { transform: translateY(-3px); box-shadow: 0 14px 28px #a3c3ee30; }
.grammar-mode__icon { display: grid; place-items: center; flex-shrink: 0; width: 68px; height: 66px; border-radius: 16px; color: var(--card-color); background: var(--card-tint); }
.grammar-mode__icon svg { width: 31px; height: 31px; stroke-width: 2; }
.grammar-mode__copy { min-width: 0; flex: 1; }
.grammar-mode__eyebrow { display: block; padding-right: 100px; min-height: 23px; color: var(--grammar-muted); font-size: 14px; }
.grammar-mode h3 { margin: 9px 0 10px; font-size: 24px; font-weight: 750; line-height: 1.3; }
.grammar-mode p { margin: 0; color: var(--grammar-muted); font-size: .92rem; line-height: 1.6; }
.grammar-mode__arrow { position: absolute; right: 23px; bottom: 17px; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: var(--card-color); background: var(--card-tint); font-size: 26px; }
.grammar-dashboard-page .grammar-mode .portal-module-card__badge--counter { position: absolute; top: 18px; right: 19px; padding: 5px 14px; border: 1px solid #ffdab3; border-radius: 22px; color: #b97420; background: #fff8ee; font-size: 13px; line-height: 1.65; font-weight: 600; box-shadow: none; }
.grammar-dashboard-page a:focus-visible, .grammar-dashboard-page button:focus-visible { outline: 3px solid #2b71ff; outline-offset: 4px; }

@media (max-width: 900px) {
  .grammar-hero { padding: 28px; }
  .grammar-hero__description { font-size: 16px; max-width: 65%; }
  .grammar-hero__description br { display: none; }
  .grammar-hero__bubble { right: 5%; font-size: 15px; }
  .grammar-stat { gap: 10px; padding: 4px 10px; }
  .grammar-stat__icon { width: 40px; height: 40px; font-size: 23px; }
  .grammar-control { padding: 20px 17px; }
  .grammar-control__heading { gap: 10px; }
  .grammar-control h2 { font-size: 19px; }
  .grammar-mode { gap: 14px; padding: 23px 18px 64px; }
  .grammar-mode__icon { width: 52px; height: 54px; }
  .grammar-mode__eyebrow { padding-right: 0; }
  .grammar-dashboard-page .grammar-mode .portal-module-card__badge--counter { top: auto; bottom: 23px; right: auto; left: 84px; }
}

@media (max-width: 640px) {
  .grammar-dashboard-page .grammar-dashboard-shell { width: calc(100% - 24px); padding-top: 12px; }
  .grammar-topbar { min-height: 66px; padding: 10px 12px; margin-bottom: 16px; border-radius: 17px; }
  .grammar-brand { gap: 8px; }
  .grammar-brand strong { font-size: 16px; }
  .grammar-brand small { font-size: 13px; }
  .grammar-brand__icon { width: 36px; height: 36px; }
  .grammar-back { padding: 10px 12px; font-size: 13px; gap: 4px; }
  .grammar-dashboard { gap: 16px; }
  .grammar-hero { min-height: 320px; padding: 26px 20px; border-radius: 18px; background-position: 60% center; }
  .grammar-hero h1 { font-size: clamp(27px, 6.8vw, 41px); }
  .grammar-eyebrow { font-size: 11px; margin-bottom: 15px; }
  .grammar-hero__description { font-size: .92rem; max-width: 86%; margin: 18px 0; }
  .grammar-hero__bubble { display: none; }
  .grammar-hero__tags { gap: 6px; }
  .grammar-hero__tags span { padding: 6px 10px; font-size: 13px; }
  .grammar-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; gap: 0; }
  .grammar-stat { padding: 14px 7px; gap: 9px; }
  .grammar-stat:nth-child(3) { border-left: 0; }
  .grammar-stat:nth-child(n+3) { border-top: 1px solid #deebfc; }
  .grammar-stat__icon { width: 35px; height: 35px; font-size: 22px; }
  .grammar-stat strong { font-size: 28px; }
  .grammar-stat p { font-size: 13px; }
  .grammar-controls { grid-template-columns: 1fr; gap: 14px; }
  .grammar-control { min-height: 154px; }
  .grammar-modes { margin-top: 8px; }
  .grammar-modes h2 { font-size: 22px; }
  .grammar-modes__heading { gap: 12px; }
  .grammar-modes__heading p { font-size: .92rem; }
  .grammar-mode-grid { grid-template-columns: 1fr; gap: 12px; }
  .grammar-mode { min-height: 181px; padding: 21px 20px 60px; }
  .grammar-mode h3 { font-size: 22px; margin: 7px 0 9px; }
  .grammar-mode__eyebrow { padding-right: 82px; font-size: 13px; }
  .grammar-dashboard-page .grammar-mode .portal-module-card__badge--counter { top: 18px; right: 15px; bottom: auto; left: auto; padding: 4px 9px; font-size: 12px; }
  .grammar-mode__arrow { width: 38px; height: 38px; right: 18px; bottom: 14px; }
}

@media (max-width: 380px) {
  .grammar-topbar { gap: 8px; }
  .grammar-brand strong { font-size: 14px; }
  .grammar-brand__icon { width: 32px; height: 32px; }
  .grammar-back { padding: 9px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .grammar-mode, .grammar-progress__track span { transition: none; }
}
