/* DegreeCraft's visual system: quiet neutrals, precise blue accents, and angle-tinted cards. */
:root {
  color-scheme: light;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #202534;
  background: #f7f8fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --ink: #202534;
  --muted: #8b93a3;
  --line: #e9ebf0;
  --accent: #5369de;
  --accent-deep: #4256c4;
  --pan-x: 0px;
  --pan-y: 0px;
  --zoom: 1;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { min-width: 320px; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid #9ba8ff; outline-offset: 2px; }

.app-shell { display: grid; width: 100%; height: 100dvh; min-height: 480px; grid-template-columns: 284px minmax(0, 1fr); }
.sidebar { z-index: 5; display: flex; min-width: 0; height: 100%; flex-direction: column; padding: 25px 18px 16px; background: #fff; border-right: 1px solid var(--line); }
.brand-row { display: flex; align-items: center; gap: 11px; padding: 0 3px; }
.brand-mark { display: grid; width: 37px; height: 37px; place-items: center; color: #fff; border-radius: 12px; background: linear-gradient(145deg, #7284f0, #4b5ecb); box-shadow: 0 4px 10px #5369de2b; }
.brand-mark svg { width: 26px; height: 26px; }
.brand-copy { display: grid; gap: 3px; }
.brand-name { color: #252b3a; font-size: 14px; font-weight: 700; letter-spacing: -.35px; }
.brand-caption { color: #9ba2af; font-size: 8px; font-weight: 700; letter-spacing: 1.15px; }
.inventory-heading { display: flex; align-items: center; justify-content: space-between; margin: 35px 3px 17px; }
.inventory-heading h1 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.25px; }
.inventory-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.inventory-total { display: grid; width: 27px; height: 27px; place-items: center; color: #6270c9; background: #f0f2ff; border-radius: 9px; font-size: 11px; font-weight: 650; }
.search-field { display: flex; height: 37px; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid #eceef2; border-radius: 10px; background: #fbfbfc; color: #a1a7b3; transition: border-color .16s, box-shadow .16s; }
.search-field:focus-within { border-color: #aeb7ee; box-shadow: 0 0 0 3px #5369de12; }
.search-field svg { flex: none; width: 16px; height: 16px; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.search-field input::placeholder { color: #a3a9b5; }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }
.search-field kbd { display: grid; width: 17px; height: 18px; flex: none; place-items: center; color: #abb1bc; border: 1px solid #e6e8ed; border-radius: 5px; background: #fff; font: 10px 'Inter', sans-serif; }
.inventory-list { display: grid; min-height: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 8px; overflow: auto; margin: 17px -4px 0; padding: 2px 4px 12px; scrollbar-color: #e5e8ef transparent; scrollbar-width: thin; }
.inventory-entry { min-width: 0; }
.inventory-entry .inventory-item { width: 100%; }
.inventory-item { --angle-hue: 220; position: relative; display: flex; height: 43px; min-width: 0; align-items: center; justify-content: flex-start; gap: 8px; padding: 0 10px; overflow: hidden; border: 1px solid hsl(var(--angle-hue) 40% 88%); border-radius: 12px; background: hsl(var(--angle-hue) 73% 97%); color: hsl(var(--angle-hue) 40% 32%); cursor: grab; user-select: none; touch-action: none; transition: transform .16s, box-shadow .16s, border-color .16s; }
.inventory-item:hover { z-index: 1; transform: translateY(-1px); border-color: hsl(var(--angle-hue) 45% 80%); box-shadow: 0 4px 10px #2129460b; }
.inventory-item:active { cursor: grabbing; }
.degree-glyph { display: grid; width: 19px; height: 19px; flex: none; place-items: center; color: hsl(var(--angle-hue) 52% 50%); border-radius: 6px; background: hsl(var(--angle-hue) 74% 91%); font-size: 13px; line-height: 1; }
.degree-value { overflow: hidden; font-size: 11px; font-weight: 650; letter-spacing: -.1px; text-overflow: ellipsis; white-space: nowrap; }
.inventory-empty { margin: 22px 4px; color: #9098a7; font-size: 11px; line-height: 1.5; }
.sidebar-footer { display: grid; gap: 10px; margin-top: auto; padding: 14px 2px 0; border-top: 1px solid #f0f1f4; }
.saved-note { display: flex; align-items: center; gap: 7px; color: #9299a7; font-size: 9px; }
.saved-dot, .hint-dot { width: 6px; height: 6px; border-radius: 50%; background: #75bc92; box-shadow: 0 0 0 3px #75bc921c; }
.reset-button { display: flex; height: 34px; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: #7c8493; cursor: pointer; text-align: left; font-size: 10px; transition: color .15s, background .15s; }
.reset-button:hover { background: #f7f7fa; color: #4d5666; }
.reset-button svg { width: 15px; height: 15px; }

.workspace { display: flex; min-width: 0; min-height: 0; flex-direction: column; }
.topbar { z-index: 2; display: flex; height: 82px; flex: none; align-items: center; justify-content: space-between; gap: 20px; padding: 0 27px 0 30px; border-bottom: 1px solid var(--line); background: #fff; }
.page-heading { display: grid; gap: 4px; }
.eyebrow { color: #a0a6b1; font-size: 8px; font-weight: 700; letter-spacing: 1.3px; }
.page-heading h2 { margin: 0; color: #242a39; font-size: 16px; font-weight: 650; letter-spacing: -.45px; }
.topbar-actions { display: flex; align-items: center; gap: 21px; }
.discovery-meter { display: grid; width: 172px; gap: 7px; }
.meter-copy { color: #434a5a; font-size: 10px; font-weight: 650; }
.meter-total { color: #939aa8; font-weight: 450; }
.meter-track { height: 4px; overflow: hidden; border-radius: 4px; background: #eff0f4; }
.meter-fill { display: block; width: 1.38%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #586be1, #8a97f2); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.clear-button { display: flex; height: 35px; align-items: center; justify-content: center; gap: 7px; padding: 0 11px; border: 1px solid #e8eaf0; border-radius: 9px; background: #fff; color: #697182; cursor: pointer; font-size: 10px; font-weight: 550; transition: border-color .16s, background .16s, color .16s; }
.clear-button:hover { border-color: #d4d8e4; background: #fafafe; color: #414a5d; }
.clear-button svg { width: 15px; height: 15px; }
.canvas-viewport { --pan-x: 50vw; --pan-y: 50vh; --zoom: 1; --grid-size: 26px; position: relative; min-width: 0; min-height: 0; flex: 1; overflow: hidden; background-color: #fbfcfd; background-image: radial-gradient(#dce1e9 1px, transparent 1px); background-size: var(--grid-size) var(--grid-size); background-position: var(--pan-x) var(--pan-y); cursor: grab; touch-action: none; }
.canvas-viewport.is-panning { cursor: grabbing; }
.world { position: absolute; inset: 0; transform: translate(var(--pan-x), var(--pan-y)) scale(var(--zoom)); transform-origin: 0 0; }
.degree-card { --angle-hue: 220; position: absolute; display: inline-flex; height: 49px; min-width: 105px; align-items: center; justify-content: center; gap: 9px; padding: 0 15px; border: 1px solid hsl(var(--angle-hue) 41% 83%); border-radius: 15px; background: hsl(var(--angle-hue) 78% 97%); color: hsl(var(--angle-hue) 44% 30%); box-shadow: 0 6px 18px #27324912, 0 1px 2px #27324908; cursor: grab; font-size: 13px; font-weight: 650; letter-spacing: -.2px; user-select: none; touch-action: none; transform: translate(-50%, -50%); transition: box-shadow .15s, border-color .15s; }
.degree-card:hover { z-index: 2; border-color: hsl(var(--angle-hue) 47% 73%); box-shadow: 0 9px 22px #2732491c, 0 1px 2px #2732490a; }
.degree-card:active, .degree-card.dragging { z-index: 5; cursor: grabbing; box-shadow: 0 12px 28px #27324925; }
.degree-card .degree-glyph { width: 21px; height: 21px; font-size: 14px; }
.degree-card.merge-target { border-color: #8090ed; box-shadow: 0 0 0 4px #6578e126, 0 9px 22px #2732491a; }
.degree-card.pop-in { animation: degree-pop .58s cubic-bezier(.16,1.3,.35,1) both; }
@keyframes degree-pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.15) rotate(-10deg); } 68% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); } 100% { transform: translate(-50%, -50%) scale(1) rotate(0); } }
.canvas-intro { position: absolute; top: 50%; left: 50%; display: grid; width: min(360px, calc(100% - 42px)); justify-items: center; gap: 10px; color: #8f97a7; text-align: center; pointer-events: none; transform: translate(-50%, -50%); transition: opacity .2s; }
.canvas-intro[hidden] { display: none; }
.intro-spark { display: grid; width: 45px; height: 45px; place-items: center; margin-bottom: 3px; color: #6172df; border: 1px solid #e2e6fa; border-radius: 15px; background: #f4f5ff; font-size: 22px; }
.intro-title { color: #4d5669; font-size: 14px; font-weight: 600; letter-spacing: -.2px; }
.intro-copy { max-width: 275px; font-size: 11px; line-height: 1.7; }
.canvas-toolbar { position: absolute; bottom: 21px; left: 22px; display: flex; height: 38px; align-items: center; gap: 2px; padding: 3px; border: 1px solid #e9ebf0; border-radius: 11px; background: #fff; box-shadow: 0 4px 14px #25304a0c; cursor: default; }
.canvas-toolbar button { display: grid; width: 29px; height: 29px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #727b8c; cursor: pointer; font-size: 17px; transition: background .14s; }
.canvas-toolbar button:hover { background: #f2f4f8; }
.canvas-toolbar #zoom-level { width: 39px; color: #788091; text-align: center; font-size: 9px; font-weight: 550; }
.toolbar-divider { width: 1px; height: 17px; margin: 0 4px; background: #e9ebf0; }
.canvas-toolbar .recenter-button svg { width: 16px; height: 16px; }
.canvas-hint { position: absolute; right: 24px; bottom: 32px; display: flex; align-items: center; gap: 8px; color: #9aa1ae; font-size: 9px; pointer-events: none; }
.canvas-hint .hint-dot { width: 5px; height: 5px; }
.hint-separator { color: #c4c9d2; }
.merge-tooltip { position: absolute; z-index: 10; display: none; align-items: center; gap: 6px; padding: 9px 11px; border: 1px solid #e8eaf2; border-radius: 9px; background: #fff; box-shadow: 0 7px 20px #25304a1a; color: #3f4960; font-size: 10px; font-weight: 600; white-space: nowrap; pointer-events: none; }
.merge-tooltip.visible { display: flex; }
.merge-tooltip .formula-equals { color: #8991a2; font-weight: 450; }
.drag-ghost { position: fixed; z-index: 30; display: none; min-width: 105px; height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; border: 1px solid hsl(var(--angle-hue, 220) 44% 80%); border-radius: 13px; background: hsl(var(--angle-hue, 220) 80% 97%); box-shadow: 0 12px 30px #26304b26; color: hsl(var(--angle-hue, 220) 46% 30%); font-size: 12px; font-weight: 650; pointer-events: none; transform: translate(-50%, -50%) rotate(-2deg); }
.drag-ghost.visible { display: flex; }
.toast-region { position: fixed; z-index: 40; top: 101px; left: calc(50% + 142px); display: grid; gap: 8px; pointer-events: none; transform: translateX(-50%); }
.toast { display: flex; align-items: center; gap: 9px; padding: 11px 15px; border: 1px solid #e8eaf1; border-radius: 12px; background: #fff; box-shadow: 0 9px 28px #29324917; color: #424b5f; font-size: 11px; animation: toast-enter .3s cubic-bezier(.2,.8,.2,1) both; }
.toast-check { display: grid; width: 19px; height: 19px; place-items: center; color: #fff; border-radius: 7px; background: #6677e6; font-size: 12px; }
.toast strong { color: #27304a; }
@keyframes toast-enter { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.particle { position: absolute; z-index: 8; width: 6px; height: 6px; border-radius: 50%; opacity: 0; pointer-events: none; animation: particle-fly .62s ease-out both; }
@keyframes particle-fly { 0% { opacity: .9; transform: translate(0,0) scale(.6); } 100% { opacity: 0; transform: translate(var(--dx),var(--dy)) scale(0); } }
.reset-dialog { width: min(360px, calc(100% - 32px)); padding: 25px; border: 1px solid #e8eaf0; border-radius: 18px; background: #fff; box-shadow: 0 24px 70px #18203b2b; color: var(--ink); }
.reset-dialog::backdrop { background: #1d243542; backdrop-filter: blur(3px); }
.dialog-icon { display: grid; width: 38px; height: 38px; place-items: center; color: #6575df; border-radius: 12px; background: #f0f2ff; font-size: 19px; }
.reset-dialog h2 { margin: 17px 0 7px; font-size: 16px; letter-spacing: -.3px; }
.reset-dialog p { margin: 0; color: #7e8797; font-size: 11px; line-height: 1.7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.dialog-actions button { min-height: 35px; padding: 0 12px; border-radius: 9px; cursor: pointer; font-size: 10px; font-weight: 600; }
.dialog-cancel { border: 1px solid #e7e9ef; background: #fff; color: #687182; }
.dialog-confirm { border: 1px solid #5369de; background: #5369de; color: #fff; }
.dialog-confirm:hover { background: #4256c4; }

@media (max-width: 760px) {
  .app-shell { min-height: 0; grid-template-columns: minmax(0,1fr); grid-template-rows: 248px minmax(0,1fr); }
  .sidebar { height: 248px; padding: 13px 15px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-row { gap: 9px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 10px; }
  .brand-mark svg { width: 22px; height: 22px; }
  .brand-name { font-size: 12px; }
  .brand-caption { font-size: 7px; }
  .inventory-heading { margin: 14px 2px 10px; }
  .inventory-heading h1 { font-size: 13px; }
  .inventory-heading p { display: none; }
  .inventory-total { width: 23px; height: 23px; font-size: 10px; }
  .search-field { height: 32px; }
  .search-field kbd { display: none; }
  .inventory-list { display: flex; min-height: 0; flex: 1; align-items: flex-start; gap: 7px; overflow-x: auto; overflow-y: hidden; margin: 10px -2px 0; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
  .inventory-entry { width: 86px; flex: none; scroll-snap-align: start; }
  .inventory-item { width: 86px; height: 37px; flex: none; gap: 6px; padding: 0 8px; scroll-snap-align: start; border-radius: 11px; }
  .inventory-item { touch-action: pan-x; }
  .inventory-item .degree-glyph { width: 17px; height: 17px; font-size: 11px; }
  .inventory-item .degree-value { font-size: 10px; }
  .inventory-empty { margin: 12px 4px; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; padding: 5px 1px 0; border: 0; }
  .saved-note { font-size: 8px; }
  .reset-button { height: 27px; gap: 5px; padding: 0 5px; font-size: 9px; }
  .reset-button svg { width: 13px; height: 13px; }
  .topbar { height: 64px; gap: 8px; padding: 0 14px; }
  .eyebrow { font-size: 7px; letter-spacing: 1px; }
  .page-heading h2 { font-size: 14px; }
  .topbar-actions { gap: 9px; }
  .discovery-meter { width: auto; gap: 5px; }
  .meter-copy { font-size: 9px; }
  .meter-track { width: 92px; height: 3px; }
  .clear-button { width: 34px; height: 32px; padding: 0; }
  .clear-button span { display: none; }
  .clear-button svg { width: 16px; height: 16px; }
  .canvas-toolbar { bottom: 13px; left: 12px; height: 35px; }
  .canvas-hint { right: 13px; bottom: 26px; gap: 6px; font-size: 8px; }
  .toast-region { top: 322px; left: 50%; }
  .canvas-intro { gap: 8px; }
  .intro-title { font-size: 13px; }
  .intro-copy { max-width: 250px; font-size: 10px; }
}
@media (max-height: 590px) and (min-width: 761px) {
  .sidebar { padding-top: 16px; }
  .inventory-heading { margin-top: 20px; }
  .topbar { height: 68px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
