      @import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700;9..144,900&family=Inter:wght@400;500;600;700;800;900&display=swap');

      :root {
        --wine-900: #3b0d16;
        --wine-800: #55101f;
        --wine-700: #74182a;
        --wine-600: #8c2438;
        --wine-100: #f3d8de;
        --paper: #f8f1e8;
        --paper-2: #fffaf4;
        --ink: #2b2020;
        --muted: #765f5f;
        --olive: #647447;
        --sea: #2f6f73;
        --gold: #c99a3d;
        --gold-soft: #ecd6a2;
        --gold-line: rgba(201, 154, 61, 0.45);
        --line: rgba(116, 24, 42, 0.14);
        --line-soft: rgba(59, 13, 22, 0.08);
        --shadow-soft: 0 1px 2px rgba(59, 13, 22, 0.06), 0 4px 12px rgba(59, 13, 22, 0.06);
        --shadow: 0 2px 4px rgba(59, 13, 22, 0.06), 0 12px 30px rgba(59, 13, 22, 0.1);
        --shadow-lift: 0 6px 12px rgba(59, 13, 22, 0.08), 0 26px 52px rgba(59, 13, 22, 0.18);
        --radius: 10px;
        --ease-premium: cubic-bezier(0.19, 1, 0.22, 1);
        --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
        --font-display: "Fraunces", Georgia, "Times New Roman", serif;
      }

      * { box-sizing: border-box; }
      html { scroll-behavior: smooth; }
      .button-help-tooltip {
        position: fixed;
        z-index: 100000;
        max-width: min(340px, calc(100vw - 24px));
        padding: 10px 13px;
        border: 1px solid rgba(255,255,255,.2);
        border-radius: 8px;
        background: #2b2020;
        color: #fff;
        box-shadow: 0 10px 30px rgba(0,0,0,.25);
        font-size: 14px;
        line-height: 1.35;
        pointer-events: none;
      }
      .button-help-tooltip[hidden] { display: none; }
      body {
        position: relative;
        margin: 0;
        min-height: 100vh;
        color: var(--ink);
        background:
          radial-gradient(1200px 600px at 100% -5%, rgba(201, 154, 61, 0.1), transparent 55%),
          radial-gradient(900px 500px at -5% 0%, rgba(116, 24, 42, 0.08), transparent 50%),
          linear-gradient(180deg, #fbf6ef, var(--paper));
        background-attachment: fixed;
        font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      }


      body.saving-workspace::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        z-index: 99999;
        background: linear-gradient(90deg, var(--gold), var(--wine-700), var(--gold-soft), var(--wine-700), var(--gold));
        background-size: 200% 100%;
        animation: loadingBar 1.1s linear infinite;
        pointer-events: none;
      }

      @keyframes loadingBar {
        from { background-position: 0% 0; }
        to { background-position: -200% 0; }
      }

      ::selection { background: var(--gold-soft); color: var(--wine-900); }

      ::-webkit-scrollbar { width: 11px; height: 11px; }
      ::-webkit-scrollbar-track { background: transparent; }
      ::-webkit-scrollbar-thumb {
        border: 3px solid transparent;
        border-radius: 999px;
        background-color: rgba(116, 24, 42, 0.28);
        background-clip: padding-box;
      }
      ::-webkit-scrollbar-thumb:hover { background-color: rgba(116, 24, 42, 0.48); }
      * { scrollbar-color: rgba(116, 24, 42, 0.28) transparent; scrollbar-width: thin; }

      button, input, textarea, select { font: inherit; }
      button { cursor: pointer; transition: transform 0.18s var(--ease-spring), box-shadow 0.22s var(--ease-premium), background 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
      a { color: inherit; text-decoration: none; }
      [hidden] { display: none !important; }

      :focus-visible {
        outline: 2px solid var(--gold);
        outline-offset: 2px;
        border-radius: 4px;
      }

      @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after {
          animation-duration: 0.001ms !important;
          animation-iteration-count: 1 !important;
          transition-duration: 0.001ms !important;
          scroll-behavior: auto !important;
        }
      }

      h1, h2 {
        font-family: var(--font-display);
        font-weight: 600;
        letter-spacing: -0.01em;
      }

      .tour-panel h3, .board-resource h3 { font-family: var(--font-display); font-weight: 600; }

      .login {
        min-height: 100vh;
        display: grid;
        grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
      }

      .login-hero {
        position: relative;
        display: flex;
        align-items: end;
        min-height: 100vh;
        padding: 56px;
        overflow: hidden;
        color: white;
        background:
          linear-gradient(180deg, rgba(59, 13, 22, 0.12), rgba(59, 13, 22, 0.86)),
          url("https://images.unsplash.com/photo-1523906834658-6e24ef2386f9?auto=format&fit=crop&w=1600&q=80") center/cover;
        animation: heroKenBurns 26s ease-in-out infinite alternate;
      }

      .login-hero::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 1;
        pointer-events: none;
        background-image:
          radial-gradient(3px 3px at 12% 22%, rgba(236, 214, 162, 0.85), transparent 60%),
          radial-gradient(2px 2px at 28% 68%, rgba(236, 214, 162, 0.6), transparent 60%),
          radial-gradient(3px 3px at 46% 38%, rgba(255, 255, 255, 0.55), transparent 60%),
          radial-gradient(2px 2px at 63% 78%, rgba(236, 214, 162, 0.7), transparent 60%),
          radial-gradient(2.5px 2.5px at 78% 18%, rgba(255, 255, 255, 0.5), transparent 60%),
          radial-gradient(2px 2px at 91% 58%, rgba(236, 214, 162, 0.65), transparent 60%);
        background-repeat: no-repeat;
        animation: heroParticles 16s ease-in-out infinite;
      }

      .login-hero::after {
        content: "";
        position: absolute;
        left: 56px;
        right: 56px;
        bottom: 0;
        height: 1px;
        z-index: 1;
        background: linear-gradient(90deg, transparent, var(--gold-soft), transparent);
        opacity: 0.6;
      }

      @keyframes heroKenBurns {
        from { background-size: 100% auto, 108% auto; background-position: center, center; }
        to { background-size: 100% auto, 118% auto; background-position: center, 42% 38%; }
      }

      @keyframes heroParticles {
        0%, 100% { transform: translateY(0) translateZ(0); opacity: 0.9; }
        50% { transform: translateY(-22px) translateZ(0); opacity: 1; }
      }

      .login-hero > div { position: relative; z-index: 2; }

      .login-hero h1 {
        margin: 0;
        max-width: 780px;
        font-family: var(--font-display);
        font-weight: 600;
        font-size: clamp(48px, 7vw, 96px);
        line-height: 0.95;
        background: linear-gradient(100deg, #ffffff 30%, var(--gold-soft) 50%, #ffffff 70%);
        background-size: 240% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: heroShimmer 9s ease-in-out infinite;
        text-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
      }

      @keyframes heroShimmer {
        0%, 100% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
      }

      .login-hero p {
        margin: 18px 0 0;
        max-width: 620px;
        color: rgba(255, 255, 255, 0.78);
        font-size: 22px;
      }

      .login-panel {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 14px;
        padding: 32px;
      }

      .login-card {
        width: min(100%, 440px);
        border: 1px solid var(--line);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.82);
        backdrop-filter: blur(18px) saturate(160%);
        padding: 28px;
        box-shadow: var(--shadow-lift);
        animation: cardRiseIn 0.7s var(--ease-premium) both;
        transition: transform 0.35s var(--ease-premium), box-shadow 0.35s var(--ease-premium);
      }

      .login-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 40px 80px rgba(59, 13, 22, 0.24);
      }

      @keyframes cardRiseIn {
        from { opacity: 0; transform: translateY(26px) scale(0.98); }
        to { opacity: 1; transform: translateY(0) scale(1); }
      }

      .contact-card {
        width: min(100%, 440px);
        display: grid;
        gap: 8px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: rgba(255, 255, 255, 0.62);
        backdrop-filter: blur(10px);
        padding: 10px 12px;
        color: var(--ink);
        animation: cardRiseIn 0.7s var(--ease-premium) 0.1s both;
      }

      .contact-card button {
        border: 0;
        border-radius: var(--radius);
        background: transparent;
        color: inherit;
        padding: 0;
        text-align: left;
      }

      .contact-card button:hover { background: rgba(116, 24, 42, 0.06); }

      .contact-card span {
        display: block;
        color: var(--muted);
        font-size: 11px;
        font-weight: 900;
        text-transform: uppercase;
      }

      .contact-card strong {
        display: block;
        margin-top: 4px;
        color: #031225;
        font-size: 14px;
        word-break: break-word;
      }

      .forgot-link {
        justify-self: end;
        margin-top: -4px;
        color: var(--wine-700);
        font-size: 13px;
        font-weight: 850;
      }

      .forgot-link:hover { text-decoration: underline; }
      .local-login-hint {
        margin: 0;
        border: 1px solid rgba(116, 24, 42, .18);
        border-radius: var(--radius);
        background: #f8f1e8;
        color: var(--wine-700);
        padding: 10px 12px;
        font-size: 13px;
      }

      .brand-row {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 24px;
      }

      .brand-mark {
        display: grid;
        place-items: center;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(145deg, var(--wine-600), var(--wine-900));
        color: white;
        font-weight: 900;
        box-shadow: 0 10px 22px rgba(59, 13, 22, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
        transform-style: preserve-3d;
        perspective: 300px;
        transition: transform 0.5s var(--ease-spring), box-shadow 0.3s ease;
      }

      .brand-mark:hover {
        transform: rotateY(180deg);
        box-shadow: 0 14px 28px rgba(59, 13, 22, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
      }

      .label {
        display: grid;
        gap: 7px;
        color: rgba(43, 32, 32, 0.75);
        font-size: 13px;
        font-weight: 750;
      }

      input, textarea, select {
        width: 100%;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: white;
        color: var(--ink);
        padding: 11px 12px;
        outline: 2px solid transparent;
      }

      textarea { min-height: 98px; resize: vertical; }
      input:focus, textarea:focus, select:focus { outline-color: var(--wine-700); }

      .app {
        display: grid;
        min-height: 100vh;
        grid-template-columns: 280px minmax(0, 1fr);
      }

      .sidebar {
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
        height: 100vh;
        padding: 16px;
        overflow: auto;
        background:
          radial-gradient(120% 60% at 0% 0%, rgba(201, 154, 61, 0.16), transparent 55%),
          linear-gradient(165deg, #4a111d 0%, var(--wine-900) 45%, #2a0a10 100%);
        color: white;
        box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05), 8px 0 32px -12px rgba(0, 0, 0, 0.4);
      }

      .sidebar-brand {
        border-radius: 12px;
        background: linear-gradient(155deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04));
        border: 1px solid rgba(255, 255, 255, 0.1);
        padding: 16px;
        margin-bottom: 18px;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
      }

      .sidebar-brand strong {
        display: block;
        margin-top: 5px;
        font-family: var(--font-display);
        font-weight: 600;
        font-size: 24px;
        line-height: 1;
        background: linear-gradient(100deg, white, var(--gold-soft));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
      }

      .nav-button {
        position: relative;
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        border: 0;
        border-radius: var(--radius);
        background: transparent;
        color: rgba(255, 255, 255, 0.76);
        padding: 11px 12px 11px 16px;
        font-weight: 650;
        text-align: left;
        transition: background 0.18s ease, color 0.18s ease;
      }

      .nav-button::before {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        width: 3px;
        height: 0;
        border-radius: 999px;
        background: linear-gradient(180deg, var(--gold), var(--gold-soft));
        transform: translateY(-50%);
        transition: height 0.22s var(--ease-spring);
      }

      .nav-button:hover {
        background: rgba(255, 255, 255, 0.08);
        color: white;
      }

      .nav-button.active {
        background: white;
        color: var(--wine-900);
      }

      .nav-button.active::before { height: 60%; }
      .external-nav::after { content: "↗"; float: right; opacity: .65; }

      .sidebar-mail {
        display: grid;
        gap: 8px;
        margin-top: auto;
        width: 100%;
        border: 0;
        border-radius: var(--radius);
        background: transparent;
        color: rgba(255, 255, 255, 0.78);
        padding: 10px 12px;
        text-align: left;
      }

      .sidebar-mail:hover { background: rgba(255, 255, 255, 0.08); }

      .sidebar-mail button {
        border: 0;
        border-radius: var(--radius);
        background: transparent;
        color: inherit;
        padding: 0;
        text-align: left;
      }

      .sidebar-mail button:hover { background: rgba(255, 255, 255, 0.08); }

      .sidebar-site-link {
        display: block;
        margin-bottom: 8px;
        color: rgba(255, 255, 255, 0.82);
        font-size: 13px;
        font-weight: 900;
      }

      .sidebar-site-link:hover { color: white; }

      .sidebar-mail span {
        display: block;
        color: rgba(255, 255, 255, 0.5);
        font-size: 11px;
        font-weight: 900;
        text-transform: uppercase;
      }

      .sidebar-mail strong {
        display: block;
        margin-top: 6px;
        color: rgba(255, 255, 255, 0.86);
        font-size: 13px;
        word-break: break-word;
      }

      .example-ad {
        display: grid;
        gap: 8px;
        margin-top: auto;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: var(--radius);
        background: rgba(255, 255, 255, 0.08);
        padding: 10px;
        color: rgba(255, 255, 255, 0.82);
      }

      .example-ad-title {
        color: white;
        font-size: 13px;
        font-weight: 900;
      }

      .example-ad button {
        width: 100%;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: var(--radius);
        background: rgba(255, 255, 255, 0.06);
        color: inherit;
        padding: 9px;
        text-align: left;
      }

      .example-ad button:hover { background: rgba(255, 255, 255, 0.12); }

      .example-ad span {
        display: block;
        color: rgba(255, 255, 255, 0.5);
        font-size: 11px;
        font-weight: 900;
        text-transform: uppercase;
      }

      .example-ad strong {
        display: block;
        margin-top: 5px;
        color: rgba(255, 255, 255, 0.9);
        font-size: 13px;
        word-break: break-word;
      }

      .tour-highlight {
        position: fixed;
        z-index: 95;
        border: 3px solid #f7c948;
        border-radius: 12px;
        box-shadow: 0 0 0 9999px rgba(20, 8, 12, 0.58), 0 18px 50px rgba(0, 0, 0, 0.25);
        pointer-events: none;
        transition: all 0.2s ease;
      }

      .tour-panel {
        position: fixed;
        z-index: 96;
        width: min(360px, calc(100vw - 32px));
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--paper-2);
        color: var(--ink);
        padding: 16px;
        box-shadow: var(--shadow);
      }

      .tour-panel h3 {
        margin: 0 0 8px;
        color: var(--wine-900);
        font-size: 22px;
      }

      .tour-panel p { margin: 0; color: var(--muted); }

      .tour-step-count {
        display: inline-block;
        margin-bottom: 10px;
        color: var(--wine-700);
        font-size: 12px;
        font-weight: 900;
        text-transform: uppercase;
      }

      .content {
        min-width: 0;
      }

      .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        border-bottom: 1px solid var(--line);
        background: rgba(251, 246, 239, 0.82);
        backdrop-filter: blur(16px) saturate(150%);
        padding: 16px 22px;
        box-shadow: 0 10px 30px -22px rgba(59, 13, 22, 0.5);
      }

      .topbar h1 {
        margin: 0;
        color: var(--wine-900);
        font-size: 28px;
      }

      .topbar p { margin: 3px 0 0; color: var(--muted); }

      .main {
        padding: 22px;
      }

      .hero {
        position: relative;
        overflow: hidden;
        border-radius: 16px;
        background:
          radial-gradient(120% 140% at 100% 0%, rgba(201, 154, 61, 0.32), transparent 45%),
          linear-gradient(135deg, var(--wine-900), var(--wine-700));
        color: white;
        padding: 28px 30px;
        box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
      }

      .hero::after {
        content: "";
        position: absolute;
        top: -70%;
        right: -8%;
        width: 55%;
        height: 240%;
        background: linear-gradient(100deg, transparent 42%, rgba(255, 255, 255, 0.1) 50%, transparent 58%);
        transform: rotate(9deg);
        pointer-events: none;
      }

      .hero h2 {
        position: relative;
        margin: 4px 0 0;
        font-family: var(--font-display);
        font-weight: 600;
        font-size: clamp(36px, 5vw, 62px);
        line-height: 0.98;
      }

      .hero p { position: relative; max-width: 760px; color: rgba(255,255,255,.76); }

      .grid { display: grid; gap: 16px; }
      .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .grid.side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
      .tools-grid { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(280px, 360px) minmax(260px, 320px); gap: 16px; align-items: start; }
      .page-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
      .dashboard-shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; perspective: 1000px; }
      .shortcut-card {
        display: grid;
        gap: 4px;
        border: 1px solid var(--line);
        border-left: 4px solid var(--sea);
        border-radius: 12px;
        background: linear-gradient(180deg, #ffffff, #fdfaf6);
        padding: 15px 17px;
        box-shadow: var(--shadow-soft);
        transition: transform 0.24s var(--ease-premium), border-color 0.24s ease, box-shadow 0.24s var(--ease-premium);
      }
      .shortcut-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lift);
        border-left-color: var(--gold);
      }
      .shortcut-card span { color: var(--sea); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
      .shortcut-card strong { color: var(--wine-900); font-size: 19px; font-weight: 700; }
      .shortcut-card small { color: var(--muted); }
      .page-grid, .grid.two, .grid.three { perspective: 1100px; }
      .entity-card {
        min-height: 190px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        border-top: 3px solid var(--wine-700);
        transition: transform .26s var(--ease-premium), border-color .26s ease, box-shadow .26s var(--ease-premium);
      }
      .card.entity-card:hover {
        transform: translateY(-5px) rotateX(2.5deg);
        border-color: var(--olive);
        box-shadow: var(--shadow-lift);
      }
      .page-head {
        margin-bottom: 16px;
        border-radius: 14px;
        background: linear-gradient(180deg, #ffffff, #fffcf8);
        border: 1px solid var(--line);
        border-left: 4px solid var(--gold);
        padding: 20px 22px;
        box-shadow: var(--shadow-soft);
      }
      .breadcrumb {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
        color: var(--muted);
        font-size: 13px;
        font-weight: 750;
      }
      .breadcrumb button {
        border: 0;
        background: transparent;
        color: var(--wine-700);
        padding: 0;
        font-weight: 850;
        cursor: pointer;
        text-decoration: underline;
        text-underline-offset: 3px;
      }
      .list-table {
        display: grid;
        gap: 10px;
      }
      .list-table { gap: 8px; }
      .list-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 14px;
        align-items: center;
        border: 1px solid var(--line-soft);
        border-radius: var(--radius);
        background: white;
        padding: 12px 14px;
        transition: border-color 0.18s ease, background 0.18s ease;
      }
      .list-row:hover { border-color: var(--line); background: var(--paper-2); }
      .activity-card {
        min-width: 0;
        box-shadow: none;
      }
      .activity-card-body {
        display: grid;
        gap: 18px;
      }
      .activity-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
        gap: 10px;
        align-items: stretch;
      }
      .activity-actions .btn {
        width: 100%;
        min-height: 48px;
        padding-inline: 10px;
        text-align: center;
        white-space: normal;
      }
      .activity-actions .btn.icon {
        min-width: 0;
      }

      .card {
        border: 1px solid var(--line);
        border-radius: 12px;
        background: linear-gradient(180deg, #ffffff, #fefbf7);
        padding: 16px;
        box-shadow: var(--shadow-soft);
        transition: box-shadow 0.24s var(--ease-premium), transform 0.24s var(--ease-premium);
      }

      .card:hover { box-shadow: var(--shadow); }
      .activity-card, .activity-card:hover { box-shadow: none; }

      .card h3, .card h2 { margin: 0; color: var(--wine-900); font-family: var(--font-display); font-weight: 600; }
      .muted { color: var(--muted); }
      .small { font-size: 13px; }
      .stack { display: grid; gap: 12px; }
      .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
      .wrap { flex-wrap: wrap; }

      .btn {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: linear-gradient(180deg, #ffffff, #fbf5ef);
        color: var(--wine-700);
        padding: 10px 14px;
        font-weight: 750;
        line-height: 1.15;
        box-shadow: 0 1px 2px rgba(59, 13, 22, 0.06);
        transition: transform 0.18s var(--ease-premium), background 0.18s ease, border-color 0.18s ease, box-shadow 0.22s var(--ease-premium), color 0.18s ease;
      }

      .btn::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.5) 48%, transparent 66%);
        background-size: 220% 100%;
        background-position: 150% 0;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
      }

      .btn:hover {
        transform: translateY(-1px);
        border-color: var(--wine-700);
        box-shadow: var(--shadow-soft);
      }

      .btn:hover::after { opacity: 1; animation: btnShine 0.85s var(--ease-premium); }

      @keyframes btnShine {
        from { background-position: 150% 0; }
        to { background-position: -50% 0; }
      }

      .btn:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(59, 13, 22, 0.14) inset; }

      .btn.primary {
        border-color: var(--wine-800);
        background: linear-gradient(160deg, var(--wine-600), var(--wine-800));
        color: white;
        box-shadow: 0 2px 5px rgba(59, 13, 22, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
      }

      .btn.primary:hover {
        box-shadow: 0 8px 20px rgba(59, 13, 22, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.22);
      }

      .btn.danger {
        border-color: #c33;
        background: #fff5f5;
        color: #a11;
      }

      .btn.soft { background: var(--paper); }
      .btn.icon { width: 40px; height: 40px; padding: 0; }
      .btn[aria-busy="true"] { cursor: wait; opacity: .88; }
      .button-spinner,
      .save-spinner {
        display: inline-block;
        width: 1em;
        height: 1em;
        border: 2px solid currentColor;
        border-right-color: transparent;
        border-radius: 50%;
        animation: save-spin .7s linear infinite;
        vertical-align: -.14em;
      }
      .save-blocker {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: grid;
        place-items: center;
        cursor: wait;
        background: rgba(45, 10, 18, .34);
        backdrop-filter: blur(2px);
      }
      .save-blocker[hidden] { display: none; }
      .save-blocker-card {
        display: grid;
        justify-items: center;
        gap: 10px;
        min-width: min(340px, calc(100vw - 32px));
        padding: 26px;
        border: 1px solid var(--line);
        border-radius: 18px;
        color: var(--wine-900);
        background: var(--paper);
        box-shadow: 0 24px 70px rgba(35, 4, 12, .28);
        animation: cardRiseIn 0.3s var(--ease-spring) both;
      }
      .save-blocker-card .save-spinner { width: 28px; height: 28px; border-width: 3px; }
      .save-blocker-card span:last-child { color: var(--muted); font-size: 14px; }
      @keyframes save-spin { to { transform: rotate(360deg); } }
      .activity-actions .btn.icon {
        width: 100%;
        height: auto;
        min-height: 48px;
      }
      .pill {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        border-radius: 999px;
        background: var(--paper);
        color: var(--wine-700);
        padding: 7px 10px;
        font-size: 12px;
        font-weight: 800;
      }
      .wheel {
        display: grid;
        place-items: center;
        min-height: 280px;
        border-radius: 50%;
        aspect-ratio: 1;
        width: min(100%, 360px);
        margin: 0 auto;
        border: 10px solid var(--wine-700);
        background:
          conic-gradient(from 0deg, #fff7ec, #f3d8de, #ffffff, #e9f0df, #fff7ec);
        box-shadow: var(--shadow), 0 0 0 6px rgba(201, 154, 61, 0.18);
        transform: perspective(1000px) rotateX(14deg) rotateZ(0deg);
        transition: transform 1.4s cubic-bezier(.2,.8,.2,1), box-shadow 0.4s ease;
        transform-style: preserve-3d;
      }
      .wheel.spinning {
        transform: perspective(1000px) rotateX(14deg) rotateZ(1080deg);
        box-shadow: var(--shadow-lift), 0 0 0 10px rgba(201, 154, 61, 0.4), 0 0 60px rgba(201, 154, 61, 0.35);
      }
      .wheel-result {
        display: grid;
        gap: 9px;
        max-width: 82%;
        border-radius: var(--radius);
        background: rgba(255,255,255,.9);
        color: var(--wine-900);
        padding: 18px;
        text-align: center;
        font-size: clamp(28px, 4vw, 48px);
        font-weight: 900;
        box-shadow: 0 10px 25px rgba(59, 13, 22, 0.12);
      }
      .wheel-result strong { color: var(--wine-900); font-size: clamp(26px, 3vw, 43px); line-height: 1; }
      .wheel-help { color: var(--muted); font-size: 12px; font-weight: 750; line-height: 1.35; }
      .tool-directory { margin-top: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.72); padding: 20px; box-shadow: 0 10px 28px rgba(59,13,22,.07); }
      .tool-directory-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
      .tool-directory-head p, .tool-directory-head h2 { margin: 0; }
      .tool-directory-head > div > p { color: var(--wine-700); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
      .tool-directory-head h2 { margin-top: 4px; color: var(--wine-900); font-size: 30px; }
      .tool-link-group + .tool-link-group { margin-top: 20px; }
      .tool-link-group h3 { margin: 0 0 10px; color: var(--wine-800); font-size: 17px; }
      .tool-link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; perspective: 1200px; }
      .tool-link-card { display: grid; gap: 7px; min-height: 132px; border: 1px solid var(--line); border-radius: var(--radius); background: white; padding: 14px; transition: transform 0.28s var(--ease-premium), box-shadow 0.28s var(--ease-premium), border-color 0.28s ease; will-change: transform; }
      .tool-link-card:hover { border-color: var(--sea); transform: translateY(-3px) rotateX(3deg) rotateY(-2deg); box-shadow: 0 18px 34px rgba(47,111,115,.18); }
      .tool-link-card strong { color: var(--wine-900); font-size: 18px; }
      .tool-link-card span { color: var(--muted); font-size: 13px; line-height: 1.4; }
      .tool-link-card small { align-self: end; color: var(--sea); font-weight: 850; }
      .history-list {
        display: grid;
        gap: 8px;
        max-height: 340px;
        overflow: auto;
      }

      .tree-list { display: grid; gap: 12px; }
      .tree-item {
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: rgba(248, 241, 232, 0.5);
        padding: 12px;
      }
      .tree-child {
        margin-top: 10px;
        margin-left: 14px;
        padding-left: 14px;
        border-left: 1px solid var(--line);
        display: grid;
        gap: 9px;
      }

      .resource-preview img,
      .board-resource img {
        max-width: 100%;
        border-radius: var(--radius);
        object-fit: contain;
      }

      .resource-preview iframe,
      .board-resource iframe {
        width: 100%;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: white;
      }

      .modal {
        position: fixed;
        inset: 0;
        z-index: 50;
        background: rgba(43, 32, 32, 0.4);
        backdrop-filter: blur(6px);
        animation: modalFadeIn 0.28s var(--ease-premium) both;
      }

      @keyframes modalFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
      }

      .drawer {
        position: absolute;
        inset-block: 0;
        right: 0;
        width: min(720px, 100%);
        overflow: auto;
        background: var(--paper-2);
        box-shadow: -25px 0 50px rgba(0,0,0,.18);
        animation: drawerSlideIn 0.38s var(--ease-premium) both;
      }

      @keyframes drawerSlideIn {
        from { opacity: 0; transform: translateX(32px); }
        to { opacity: 1; transform: translateX(0); }
      }

      .drawer-head {
        position: sticky;
        top: 0;
        z-index: 2;
        display: flex;
        justify-content: space-between;
        gap: 16px;
        border-bottom: 1px solid var(--line);
        background: var(--paper);
        padding: 18px;
      }

      .drawer-body { padding: 18px; display: grid; gap: 14px; }
      .form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .form-grid .wide { grid-column: 1 / -1; }

      .subtree-dialog {
        position: absolute;
        inset: 34px;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        overflow: hidden;
        border-radius: var(--radius);
        background: var(--paper-2);
        box-shadow: var(--shadow-lift);
        animation: cardRiseIn 0.32s var(--ease-premium) both;
      }
      .subtree-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        border-bottom: 1px solid var(--line);
        background: var(--paper);
        padding: 16px 20px;
      }
      .subtree-head p { margin: 0 0 4px; color: var(--wine-700); font-weight: 850; }
      .subtree-head h2 { margin: 0; color: var(--wine-900); }
      .subtree-body { min-height: 0; padding: 24px; }
      .subtree-course-tree { width: 100%; }

      .studio {
        position: fixed;
        inset: 0;
        z-index: 70;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        background: #efe7dd;
        color: var(--ink);
        animation: modalFadeIn 0.3s var(--ease-premium) both;
      }
      .studio-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        border-bottom: 1px solid var(--line);
        background: white;
        padding: 12px 18px;
        box-shadow: 0 8px 24px rgba(59, 13, 22, 0.08);
      }
      .studio-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }
      .studio-tool-picker {
        display: grid;
        gap: 3px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 800;
      }
      .studio-tool-picker select {
        min-width: 130px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: white;
        padding: 7px 9px;
      }
      .slide-world {
        overflow: auto;
        padding: 36px;
      }
      .slide-strip {
        position: relative;
        width: 960px;
        min-height: 760px;
        margin-inline: auto;
      }
      .slide-frame {
        position: relative;
        width: 960px;
        height: 540px;
        overflow: visible;
        border: 3px dashed rgba(116, 24, 42, 0.38);
        border-radius: 6px;
        background: rgba(255, 253, 249, 0.86);
        box-shadow: 0 24px 60px rgba(59, 13, 22, 0.16);
        pointer-events: auto;
      }
      .slide-frame.current {
        border-color: var(--wine-700);
        box-shadow: 0 0 0 5px rgba(116, 24, 42, 0.08), 0 24px 60px rgba(59, 13, 22, 0.16);
      }
      .slide-frame::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        top: 10px;
        z-index: 3;
        border-radius: 999px;
        background: rgba(116, 24, 42, 0.08);
        color: var(--wine-700);
        padding: 5px 9px;
        font-size: 12px;
        font-weight: 850;
        pointer-events: none;
      }
      .slide-el {
        position: absolute;
        z-index: 5;
        min-width: 60px;
        min-height: 40px;
        border: 1px solid rgba(116, 24, 42, 0.22);
        border-radius: 6px;
        background: white;
        overflow: auto;
        resize: both;
        box-shadow: 0 10px 20px rgba(59, 13, 22, 0.08);
      }

      .board-slide-inner .slide-el {
        overflow: hidden;
        resize: none;
        box-shadow: none;
      }

      .board-slide-inner .slide-text {
        overflow: hidden;
        padding: 10px;
      }
      .slide-el.selected {
        outline: 3px solid var(--wine-700);
        outline-offset: 2px;
      }
      .slide-el.dragging {
        opacity: 0.78;
      }
      .slide-text {
        width: 100%;
        height: 100%;
        padding: 14px;
        font-size: 34px;
        line-height: 1.18;
        outline: 0;
      }
      .slide-el img,
      .slide-el video,
      .slide-el iframe {
        width: 100%;
        height: 100%;
        border: 0;
        object-fit: contain;
        background: white;
      }
      .slide-el audio {
        width: calc(100% - 20px);
        margin: 18px 10px;
      }
      .slide-document-card {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 14px;
        padding: 24px;
        text-align: center;
        background: #fffaf5;
        border: 2px dashed #d7b9bf;
        border-radius: 16px;
        overflow: auto;
      }
      .slide-document-card strong { color: #7f243d; font-size: 1.2rem; }
      .slide-document-card span { color: #665a5d; font-size: .9rem; }
      .slide-document-card.loaded {
        display: block;
        padding: 22px 28px;
        text-align: left;
        background: white;
        border-style: solid;
      }
      .document-preview-content { width: 100%; color: #252022; line-height: 1.5; }
      .document-preview-content p { margin: 0 0 .8em; white-space: pre-wrap; }
      .pptx-preview { display: block; }
      .pptx-preview-slide {
        min-height: 180px;
        padding: 20px;
        border: 1px solid #dec9ce;
        border-radius: 12px;
        background: #fffdf9;
        box-shadow: 0 4px 12px rgba(90, 34, 48, .08);
      }
      .pptx-preview-slide[hidden] { display: none; }
      .pptx-preview-slide > strong { display: block; margin-bottom: 14px; }
      .pptx-preview-image {
        display: block;
        max-width: 100%;
        max-height: 320px;
        margin: 0 auto 14px;
        object-fit: contain;
      }
      .pptx-preview-controls {
        position: sticky;
        bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 12px;
        background: rgba(255, 255, 255, .94);
        border-top: 1px solid #dec9ce;
      }
      .document-preview-fallback {
        display: flex;
        min-height: 100%;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 14px;
      }
      .document-preview-fallback[hidden] { display: none; }
      .slide-tool {
        display: grid;
        align-content: start;
        gap: 9px;
        width: 100%;
        height: 100%;
        overflow: hidden;
        border: 2px solid rgba(116, 24, 42, 0.18);
        border-radius: 6px;
        background: linear-gradient(145deg, #fffdf9, #f7ece4);
        padding: 14px;
        text-align: center;
      }
      .slide-tool strong { color: var(--wine-900); font-size: 24px; }
      .slide-tool p { margin: 0; color: var(--muted); font-size: 15px; }
      .slide-tool-kicker { color: var(--wine-700); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
      .slide-tool-head { display: grid; gap: 7px; }
      .slide-tool-settings { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 8px; }
      .slide-tool-settings label, .slide-timer-setting { display: grid; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 850; text-align: left; }
      .slide-tool-settings select, .slide-tool-settings input, .slide-timer-setting input {
        width: 100%;
        min-width: 0;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: white;
        padding: 6px 8px;
        color: var(--ink);
        font: inherit;
      }
      .slide-tool-class-name { font-size: 17px !important; }
      .slide-wheel-visual {
        display: grid;
        place-items: center;
        width: 116px;
        height: 116px;
        margin: 0 auto;
        border: 8px solid var(--wine-700);
        border-radius: 50%;
        background: conic-gradient(#8b142c 0 20%, #f0d7b5 20% 40%, #d98c73 40% 60%, #647447 60% 80%, #f7ece4 80%);
        box-shadow: inset 0 0 0 8px white, 0 8px 20px rgba(59, 13, 22, .15);
      }
      .slide-wheel-visual .slide-tool-result {
        display: grid;
        place-items: center;
        width: 82px;
        height: 82px;
        overflow: hidden;
        border-radius: 50%;
        background: rgba(255,255,255,.94);
        padding: 7px;
        font-size: 16px;
        line-height: 1.05;
      }
      .slide-tool-summary { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px 12px; color: var(--muted); font-size: 11px; font-weight: 800; }
      .slide-student-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; max-height: 78px; overflow: auto; }
      .slide-student {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        min-width: 0;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: white;
        padding: 5px 7px;
        color: var(--ink);
        font-size: 11px;
        text-align: left;
      }
      .slide-student span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .slide-student small { flex: 0 0 auto; color: var(--muted); }
      .slide-student.absent { opacity: .5; text-decoration: line-through; background: #f9dfe4; }
      .slide-tool-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
      .slide-tool-buttons .btn { min-height: 34px; padding: 7px 10px; font-size: 11px; }
      .slide-timer { place-items: center; align-content: center; gap: 16px; }
      .slide-timer-face {
        display: grid;
        place-items: center;
        min-width: 300px;
        border: 3px solid var(--wine-700);
        border-radius: 18px;
        background: white;
        padding: 24px 30px;
        box-shadow: 0 12px 25px rgba(59, 13, 22, .12);
      }
      .slide-timer .timer-face-small { width: min(48%, 210px); margin: 0 auto; }
      .slide-timer .timer-face-small .timer-face-inner { width: 72%; }
      .slide-timer .embedded-timer-display { color: var(--wine-900); font-size: clamp(30px, 5vw, 54px); line-height: 1; font-variant-numeric: tabular-nums; }
      .slide-timer-setting { width: 130px; text-align: center; }
      .slide-wheel.spinning .slide-tool-result { animation: toolPulse .18s ease-in-out infinite alternate; }
      @keyframes toolPulse { to { transform: scale(1.08); opacity: .55; } }

      .print-preview-shell {
        position: fixed;
        inset: 20px;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        overflow: hidden;
        border-radius: var(--radius);
        background: #ebe5df;
        box-shadow: var(--shadow);
      }
      .print-preview-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        border-bottom: 1px solid var(--line);
        background: white;
        padding: 14px 18px;
      }
      .print-preview-toolbar p { margin: 4px 0 0; }
      .print-preview-scroll { overflow: auto; padding: 28px; }
      .printable-activity {
        width: min(100%, 1040px);
        margin: 0 auto;
        background: white;
        padding: 42px;
        box-shadow: 0 16px 45px rgba(43, 32, 32, .14);
      }
      .printable-lesson { width: min(100%, 1040px); margin: 0 auto; background: white; padding: 42px; box-shadow: 0 16px 45px rgba(43,32,32,.14); }
      .print-lesson-head { min-height: 420px; display: grid; align-content: center; border-bottom: 5px solid var(--wine-700); }
      .print-lesson-head h1 { margin: 5px 0 12px; color: var(--wine-900); font-size: 46px; }
      .print-lesson-activity { margin-top: 34px; }
      .print-activity-head h1 { margin: 4px 0 12px; color: var(--wine-900); font-size: 36px; }
      .print-breadcrumb { margin: 0; color: var(--wine-700); font-size: 13px; font-weight: 850; }
      .print-activity-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 22px 0 0; }
      .print-activity-meta div { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
      .print-activity-meta dt { color: var(--wine-700); font-size: 12px; font-weight: 900; text-transform: uppercase; }
      .print-activity-meta dd { margin: 4px 0 0; white-space: pre-line; }
      .print-slide-page { margin-top: 32px; break-inside: avoid; }
      .print-slide-page h2, .print-resources h2 { color: var(--wine-900); }
      .print-slide-canvas { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--line); background: #fffdf9; }
      .print-slide-element { position: absolute; overflow: hidden; }
      .print-slide-element img { width: 100%; height: 100%; object-fit: contain; }
      .print-slide-text { padding: 6px; white-space: pre-line; line-height: 1.18; }
      .print-slide-placeholder { display: grid; place-items: center; align-content: center; gap: 6px; border: 1px dashed var(--line); background: #f8f1e8; padding: 10px; text-align: center; }
      .print-slide-placeholder span { max-width: 100%; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
      .print-resources { margin-top: 30px; }
      .youtube-card {
        position: relative;
        display: grid;
        place-items: center;
        width: 100%;
        height: 100%;
        overflow: hidden;
        background: #111;
        color: white;
        text-align: center;
      }
      .youtube-card img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0.72;
      }
      .youtube-card a {
        position: relative;
        z-index: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        border-radius: 999px;
        background: rgba(116, 24, 42, 0.94);
        color: white;
        padding: 14px 20px;
        font-weight: 900;
        box-shadow: 0 12px 35px rgba(0,0,0,.28);
      }
      .youtube-card span {
        position: relative;
        z-index: 1;
        display: block;
        margin-top: 12px;
        max-width: 70%;
        color: rgba(255,255,255,.85);
        font-weight: 750;
      }
      .studio-note {
        color: var(--muted);
        font-size: 13px;
        font-weight: 700;
      }
      .studio-save-status {
        width: fit-content;
        margin-top: 7px;
        border-radius: 999px;
        padding: 5px 10px;
        font-size: 12px;
        font-weight: 850;
      }
      .studio-save-status.pending { background: #fff3cd; color: #765b00; }
      .studio-save-status.success { background: #e2f4e6; color: #245c31; }
      .studio-save-status.error { background: #f9dfe4; color: #8b142c; }

      .notice {
        position: fixed;
        right: 18px;
        bottom: 18px;
        z-index: 80;
        border: 1px solid var(--line);
        border-left: 3px solid var(--gold);
        border-radius: var(--radius);
        background: white;
        color: var(--wine-700);
        padding: 13px 16px;
        box-shadow: var(--shadow-lift);
        font-weight: 800;
        animation: noticeSlideIn 0.4s var(--ease-spring) both;
      }

      @keyframes noticeSlideIn {
        from { opacity: 0; transform: translateY(14px) scale(0.96); }
        to { opacity: 1; transform: translateY(0) scale(1); }
      }

      .board {
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        background: #111;
        color: var(--ink);
        padding: 0;
      }

      .board-wrap {
        width: 100vw;
        height: 100vh;
        display: grid;
        place-items: center;
      }
      .board-head {
        display: none;
        border-radius: var(--radius);
        background: var(--wine-900);
        color: white;
        padding: 32px;
        box-shadow: var(--shadow);
      }
      .board-head h1 {
        margin: 10px 0 0;
        font-size: clamp(46px, 7vw, 90px);
        line-height: 1;
      }
      .board-section {
        margin-top: 20px;
        border: 2px solid var(--wine-700);
        border-radius: 14px;
        background: white;
        padding: 28px;
        box-shadow: var(--shadow-lift), 0 0 0 8px rgba(201, 154, 61, 0.08);
        animation: boardEnter 0.55s var(--ease-premium) both;
      }
      @keyframes boardEnter {
        from { opacity: 0; transform: translateY(24px) scale(0.985); }
        to { opacity: 1; transform: translateY(0) scale(1); }
      }
      .board-section h2 { margin: 0; color: var(--wine-900); font-family: var(--font-display); font-weight: 600; font-size: 38px; }
      .board-section p { font-size: clamp(30px, 4vw, 52px); line-height: 1.35; white-space: pre-line; }
      .board-resource { display: grid; gap: 16px; }
      .board-resource h3 { font-size: 32px; margin: 0; color: var(--wine-900); }
      .board-resource audio, .board-resource video { width: 100%; }
      .board-resource video, .board-resource iframe { min-height: 58vh; }
      .board-resource img { max-height: 62vh; width: 100%; }
      .board-slide-stage {
        width: 100vw;
        height: 100vh;
        position: relative;
        overflow: hidden;
        border-radius: 0;
        background: #fffdf9;
        box-shadow: none;
      }
      .board-slide-inner {
        position: absolute;
        left: 0;
        top: 0;
        width: 960px;
        height: 540px;
        transform-origin: top left;
      }
      .board-slide-inner .slide-el {
        resize: none;
        box-shadow: none;
        border-color: transparent;
      }
      .board-controls {
        position: fixed;
        left: 50%;
        bottom: 18px;
        transform: translateX(-50%);
        display: flex;
        gap: 8px;
        border-radius: var(--radius);
        background: rgba(255,255,255,.9);
        padding: 8px;
        box-shadow: 0 12px 35px rgba(0,0,0,.2);
        opacity: 0.2;
        transition: opacity .15s ease;
      }
      .board-controls:hover {
        opacity: 1;
      }

      .empty {
        border: 1px dashed var(--line);
        border-radius: var(--radius);
        padding: 18px;
        color: var(--muted);
        background: rgba(255,255,255,.52);
      }

      /* Arbre vertical indenté (façon explorateur de fichiers) : la largeur ne dépend plus
         du nombre de feuilles, donc pas de défilement latéral même avec beaucoup d'activités. */
      .course-tree-scroll {
        overflow-y: auto;
        overflow-x: hidden;
        max-height: min(70vh, 860px);
        border: 1px solid var(--line);
        border-radius: 14px;
        background: linear-gradient(180deg, #fffdfa, #fdf8f2);
        padding: 20px 22px 26px;
        box-shadow: var(--shadow);
      }

      .course-tree { width: 100%; }

      .course-tree ul {
        position: relative;
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 0;
        padding: 0;
      }

      .course-tree > ul { margin-top: 12px; }

      .course-tree ul ul {
        margin: 8px 0 2px 21px;
        padding-left: 21px;
        border-left: 2px dashed rgba(116, 24, 42, 0.24);
      }

      .course-tree li {
        position: relative;
        list-style: none;
      }

      .course-tree li::before {
        content: "";
        position: absolute;
        top: 50%;
        left: -21px;
        width: 17px;
        height: 2px;
        background: rgba(116, 24, 42, 0.24);
        transform: translateY(-50%);
      }
      .course-tree > ul > li::before { display: none; }

      .tree-node {
        position: relative;
        z-index: 1;
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-height: 42px;
        border: 1px solid var(--line-soft);
        border-left: 4px solid var(--line);
        border-radius: 9px;
        background: white;
        color: var(--wine-900);
        padding: 9px 14px;
        text-align: left;
        white-space: normal;
        box-shadow: 0 1px 2px rgba(59, 13, 22, 0.05);
        transition: transform 0.18s var(--ease-premium), border-color 0.18s ease, box-shadow 0.2s var(--ease-premium);
      }

      .tree-node:hover {
        transform: translateX(3px);
        border-left-color: var(--wine-700);
        box-shadow: var(--shadow-soft);
      }

      .tree-node span {
        flex: 0 0 auto;
        min-width: 62px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
      }

      .tree-node strong {
        flex: 1 1 auto;
        overflow-wrap: anywhere;
        font-size: 14px;
        font-weight: 650;
        line-height: 1.25;
      }

      .tree-node em {
        flex: 0 0 auto;
        border-radius: 999px;
        background: rgba(179, 47, 60, 0.12);
        color: #b32f3c;
        padding: 2px 9px;
        font-size: 10px;
        font-style: normal;
        font-weight: 800;
      }

      .tree-node-stack {
        position: relative;
        z-index: 1;
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
      }
      .tree-node-stack .tree-node { flex: 1 1 auto; width: auto; }
      .tree-node-action {
        flex: 0 0 auto;
        border: 1px solid var(--line-soft);
        border-radius: 999px;
        background: transparent;
        color: var(--sea);
        padding: 6px 12px;
        font-size: 10px;
        font-weight: 700;
        white-space: nowrap;
        transition: border-color 0.18s ease, background 0.18s ease;
      }
      .tree-node-action:hover { border-color: var(--sea); background: #eef7f7; }

      .tree-heading {
        border-left-color: var(--gold);
        background: linear-gradient(120deg, var(--wine-900), #521021);
        color: white;
        box-shadow: 0 6px 18px -6px rgba(59, 13, 22, 0.5);
      }

      .tree-heading span { color: rgba(255, 255, 255, 0.68); }
      .tree-heading strong { color: white; }
      .tree-class { border-left-color: var(--wine-700); background: linear-gradient(90deg, rgba(116,24,42,0.05), #ffffff 60%); }
      .tree-sequence { border-left-color: var(--sea); background: linear-gradient(90deg, rgba(47,111,115,0.05), #ffffff 60%); }
      .tree-lesson { border-left-color: var(--olive); background: linear-gradient(90deg, rgba(100,116,71,0.05), #ffffff 60%); }
      .tree-activity { border-left-color: var(--gold); background: linear-gradient(90deg, rgba(201,154,61,0.06), #ffffff 60%); }
      .tree-resource { border-left-color: #8a7fae; background: linear-gradient(90deg, rgba(138,127,174,0.06), #ffffff 60%); }

      .category-group .page-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 16px;
      }
      .category-group { margin-bottom: 28px; }
      .category-group .class-grid-card { min-height: 190px; padding: 16px; }
      .class-grid-card-body { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
      .class-grid-card-body h3 { font-size: 24px; line-height: 1.25; }
      .class-grid-card-body p { margin: 12px 0 0; }
      .class-grid-card-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px; }
      .class-grid-card-actions .btn.danger { padding-inline: 10px; }
      .category-drawer { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; width: min(1180px, calc(100% - 48px)); }
      .category-drawer-head { position: static; }
      .category-drawer-head h2 { margin: 2px 0 6px; color: var(--wine-900); }
      .category-eyebrow { margin: 0; color: var(--wine-700); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
      .category-manager { overflow: auto; align-content: start; padding: 20px; }
      .category-step { display: grid; gap: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.65); padding: 16px; }
      .category-step-title { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: start; gap: 12px; }
      .category-step-title > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--wine-700); color: white; font-size: 20px; font-weight: 900; }
      .category-step-title h3 { margin: 0; color: var(--wine-900); font-size: 20px; }
      .category-step-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
      .category-editor-list, .category-class-list, .category-class-groups { display: grid; gap: 9px; }
      .category-editor-item {
        display: grid;
        grid-template-columns: auto minmax(190px, 1fr) auto auto;
        align-items: end;
        gap: 10px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: white;
        padding: 10px;
      }
      .category-order-buttons { display: grid; gap: 5px; padding-bottom: 1px; }
      .category-order-buttons .btn { min-height: 32px; padding: 6px 9px; font-size: 11px; }
      .category-name-field { min-width: 0; }
      .category-name-field .input { width: 100%; min-width: 0; }
      .category-count { align-self: center; white-space: nowrap; }
      .category-add-box { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: end; gap: 10px; border: 2px dashed rgba(116,24,42,.22); border-radius: 12px; background: #fffdf9; padding: 12px; }
      .category-class-group { display: grid; gap: 9px; border: 1px solid rgba(116,24,42,.18); border-radius: 14px; background: #fffaf5; padding: 12px; }
      .category-class-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
      .category-class-group-head h4 { margin: 0; color: var(--wine-900); font-size: 17px; }
      .category-class-group-head span { border-radius: 999px; background: var(--paper); padding: 5px 9px; color: var(--wine-700); font-size: 12px; font-weight: 850; }
      .category-class-empty { margin: 0; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }
      .category-class-row {
        display: grid;
        grid-template-columns: 38px minmax(110px, .8fr) minmax(190px, 1fr) auto;
        align-items: end;
        gap: 12px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: white;
        padding: 11px 12px;
      }
      .category-class-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--paper); color: var(--wine-700); font-weight: 900; }
      .category-class-name { display: grid; gap: 2px; min-width: 0; }
      .category-class-name strong { overflow: hidden; color: var(--wine-900); text-overflow: ellipsis; white-space: nowrap; }
      .category-class-name small { color: var(--muted); }
      .category-class-row .label { min-width: 0; }
      .category-class-order { display: grid; gap: 5px; }
      .category-class-order > span { color: var(--ink); font-size: 12px; font-weight: 800; }
      .category-class-order > div { display: flex; gap: 5px; }
      .category-class-order .btn { min-height: 38px; padding: 7px 9px; font-size: 11px; }
      .category-manager-footer { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); background: var(--paper); padding: 14px 18px; }
      .category-manager-footer .primary { min-width: 230px; }
      .item-move-buttons { display: inline-grid; grid-template-rows: repeat(2, 34px); gap: 7px; align-self: center; }
      .item-move-buttons .btn.icon { width: 38px; min-height: 34px; padding: 3px; font-size: 17px; line-height: 1; }
      .context-order-list { display: grid; gap: 10px; }
      .context-order-row {
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr) auto;
        align-items: center;
        gap: 14px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: white;
        padding: 12px 14px;
      }

      .numbered-list {
        display: grid;
        gap: 12px;
        counter-reset: item;
      }

      .numbered-list > article {
        counter-increment: item;
        position: relative;
        padding-left: 58px;
      }

      .numbered-list > article::before {
        content: counter(item);
        position: absolute;
        left: 14px;
        top: 14px;
        display: grid;
        place-items: center;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: var(--wine-700);
        color: white;
        font-weight: 900;
      }

      .timer-face {
        --timer-angle: 0deg;
        --timer-green-angle: 0deg;
        position: relative;
        display: grid;
        place-items: center;
        width: min(100%, 310px);
        aspect-ratio: 1;
        margin: 18px auto 10px;
        border-radius: 50%;
        border: 1px solid var(--line);
        background:
          repeating-conic-gradient(rgba(59,13,22,.12) 0 1deg, transparent 1deg 15deg),
          conic-gradient(#41945f 0 var(--timer-green-angle), #ca4545 var(--timer-green-angle) var(--timer-angle), #fff var(--timer-angle) 360deg);
        box-shadow: 0 14px 30px rgba(59,13,22,.14);
      }
      .timer-face-inner {
        position: relative;
        z-index: 2;
        display: grid;
        place-items: center;
        gap: 4px;
        width: 76%;
        aspect-ratio: 1;
        border: 1px solid var(--line);
        border-radius: 50%;
        background: #fffdf9;
        box-shadow: inset 0 0 24px rgba(59,13,22,.08);
        animation: timerBreathe 3.6s ease-in-out infinite;
      }

      @keyframes timerBreathe {
        0%, 100% { box-shadow: inset 0 0 24px rgba(59, 13, 22, 0.08), 0 0 0 rgba(201, 154, 61, 0); }
        50% { box-shadow: inset 0 0 24px rgba(59, 13, 22, 0.08), 0 0 20px rgba(201, 154, 61, 0.22); }
      }
      .timer-face-inner > span { color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; }
      .timer-hand {
        position: absolute;
        z-index: 3;
        left: calc(50% - 2px);
        bottom: 50%;
        width: 4px;
        height: 43%;
        border-radius: 999px;
        background: var(--wine-900);
        box-shadow: 0 0 0 1px rgba(255,255,255,.5);
        transform: rotate(var(--timer-angle));
        transform-origin: 50% 100%;
        transition: transform .35s linear, background .2s ease;
      }
      .timer-display {
        color: var(--wine-900);
        font-size: clamp(42px, 6vw, 68px);
        font-weight: 900;
        text-align: center;
        font-variant-numeric: tabular-nums;
      }
      .timer-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; color: var(--muted); font-size: 12px; text-align: center; }
      .timer-legend strong:first-of-type { color: #2d7f4a; }
      .timer-legend strong:last-of-type { color: #b32f3c; }

      @media (max-width: 960px) {
        .login, .app { grid-template-columns: 1fr; }
        .login-hero { min-height: 42vh; padding: 32px; }
        .sidebar { position: static; height: auto; }
        .grid.two, .grid.three, .grid.side { grid-template-columns: 1fr; }
        .tools-grid { grid-template-columns: 1fr; }
        .form-grid { grid-template-columns: 1fr; }
        .topbar { align-items: flex-start; flex-direction: column; }
        .subtree-dialog { inset: 10px; }
        .category-drawer { width: 100%; }
        .category-editor-item { grid-template-columns: 1fr auto; align-items: end; }
        .category-order-buttons { grid-column: 1; }
        .category-name-field { grid-column: 1 / -1; grid-row: 1; }
        .category-count { justify-self: start; }
        .category-add-box, .category-class-row { grid-template-columns: 1fr; }
        .category-class-number { display: none; }
        .category-class-order > div { display: grid; grid-template-columns: 1fr 1fr; }
        .category-manager-footer { flex-direction: column-reverse; }
        .category-manager-footer .btn { width: 100%; }
      }

      @media print {
        @page { size: A4 landscape; margin: 10mm; }
        body::before, body::after { display: none !important; }
        body > :not(#editorModal) { display: none !important; }
        #editorModal { position: static; display: block !important; background: white; }
        .print-preview-shell { position: static; display: block; overflow: visible; box-shadow: none; }
        .print-preview-toolbar { display: none; }
        .print-preview-scroll { overflow: visible; padding: 0; }
        .printable-activity { width: 100%; padding: 0; box-shadow: none; }
        .printable-lesson { width: 100%; padding: 0; box-shadow: none; }
        .print-lesson-head { min-height: 0; break-after: page; }
        .print-lesson-activity { margin: 0; }
        .print-activity-head { break-after: page; }
        .print-slide-page { margin: 0; break-after: page; }
        .print-slide-page:last-of-type { break-after: auto; }
        .print-slide-page h2 { margin-top: 0; }
        .print-slide-canvas { width: 100%; }
        .board-controls { display: none; }
      }
