:root { --sidebar-width: 280px; color: #333333; font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
* { box-sizing: border-box; }
body { height: 100dvh; font-family: inherit; }
[hidden] { display: none !important; }
.sidebar { height: 100dvh; border-right: 1px solid #e0e0e0; }
.sidebar-content { padding: 24px 20px; gap: 24px; }
h2 { font-size: 20px; line-height: 1.3; }
.back { color: #832EC5; font-size: 14px; min-height: 44px; display: flex; align-items: center; text-decoration: none; }
label { font-size: 14px; font-weight: 600; }
.control label { display: flex; justify-content: space-between; gap: 8px; }
output { color: #832EC5; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; width: 100%; height: 44px; accent-color: #832EC5; cursor: pointer; margin: 0; }
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
button { min-height: 44px; border: 1px solid #e0e0e0; background: #f5f5f5; color: #333333; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px #00000018; }
button[aria-pressed="true"] { border-color: #832EC5; background: #efe1fa; color: #63208f; }
.btn-primary { background: linear-gradient(135deg, #a31cdf, #832EC5); color: white; border: none; font-weight: 600; }
.toggles { display: flex; justify-content: space-between; gap: 8px; }
.toggles label { display: flex; align-items: center; gap: 6px; min-height: 44px; font-size: 13px; cursor: pointer; }
input[type="checkbox"] { accent-color: #832EC5; width: 18px; height: 18px; }
.hint { color: #666666; font-size: 13px; line-height: 1.5; }
:focus-visible { outline: 3px solid #832EC5; outline-offset: 3px; }
.sidebar-toggle-btn, .sidebar-toggle-btn:hover { width: 44px; right: -44px; height: 48px; opacity: 1; }
.main-content { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; align-items: stretch; padding: 24px 48px; gap: 12px; overflow: hidden; height: 100dvh; color: #333333; background: radial-gradient(ellipse at top, #faf5ff, #f5f5f5); }
.main-content::before, .main-content::after { display: none; }
header { text-align: center; }
.eyebrow { color: #70597f; font-size: 11px; font-weight: 600; letter-spacing: 1px; }
h1 { font-size: clamp(24px, 3vw, 36px); line-height: 1.25; margin: 6px 0; }
.instruction { font-size: 14px; line-height: 1.5; color: #666666; }
.canvas { min-height: 0; min-width: 0; display: flex; justify-content: center; align-items: center; border: 1px solid #e5d6f0; background: white; border-radius: 16px; box-shadow: 0 4px 12px #00000008; }
svg#ruler { display: block; width: 100%; height: 100%; }
.tick-label { font-size: 20px; fill: #554563; font-weight: 500; }
.ray-label { font-size: 15px; font-weight: 700; }
footer { text-align: center; padding: 8px; }
footer strong { font-size: clamp(20px, 2.5vw, 30px); color: #832EC5; }
footer p { font-size: 14px; color: #666666; margin-top: 4px; }
@media (max-height: 700px) and (min-width: 769px) { .sidebar-content { gap: 12px; padding: 16px; } .main-content { padding-top: 16px; padding-bottom: 12px; gap: 8px; } }
@media (max-width: 768px) {
  body { display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar, body.sidebar-collapsed .sidebar { position: relative; width: 100%; min-width: 0; height: auto; transform: none; border-right: none; border-bottom: 1px solid #e0e0e0; }
  .sidebar-toggle-btn { display: none; }
  .sidebar-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; padding: 8px 16px; height: auto; overflow: visible; }
  .back { grid-column: 1; }
  h2 { grid-column: 2; grid-row: 1; align-self: center; font-size: 15px; text-align: right; }
  .presets, .toggles { grid-column: 1 / -1; }
  .toggles { justify-content: space-around; }
  #reset { grid-column: 1; }
  .hint { grid-column: 2; font-size: 11px; align-self: center; line-height: 1.35; }
  .control label { font-size: 12px; }
  .main-content { margin-left: 0; padding: 12px 16px 8px; gap: 6px; height: auto; }
  .eyebrow { display: none; }
  h1 { font-size: 24px; margin: 0 0 4px; }
  .instruction { font-size: 12px; }
  footer { padding: 4px 0; }
  footer strong { font-size: 20px; }
  footer p { font-size: 12px; margin-top: 2px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media (max-width: 768px) and (max-height: 500px) and (min-width: 568px) {
  body { display: block; }
  .sidebar, body.sidebar-collapsed .sidebar { position: absolute; width: 240px; height: 100dvh; border-right: 1px solid #e0e0e0; }
  .sidebar-content { display: flex; flex-direction: column; gap: 8px; height: 100%; overflow-y: auto; padding: 8px 16px; }
  .sidebar h2 { text-align: left; align-self: start; }
  .back { min-height: 32px; }
  .presets, .toggles { width: 100%; }
  .hint { display: none; }
  .main-content { margin-left: 240px; height: 100dvh; padding: 8px 12px; }
  h1 { font-size: 20px; }
  .instruction { font-size: 11px; }
  footer strong { font-size: 18px; }
}
