/* Minifix — Özgür: graphite, white and red. Shared across every screen. */
:root {
  --f-display: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-body: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --r-sm: 12px; --r: 16px; --r-lg: 22px; --rail: 108px; --top: 76px;
}
:root[data-theme="light"] {
  --bg: #f7f7f8; --panel: #fff; --panel-2: #f5f5f7; --raise: #ededf0;
  --ink: #202023; --muted: #66666f; --line: #e6e6ea; --line-2: #d1d1d8;
  --accent: #c91520; --accent-ink: #fff; --accent-soft: #c915200c;
  --board: #dedbd6; --board-edge: #77736e; --cell: #fafafa; --front: #e5e0d8;
  --viewer-bg: #eeedef; --bar-bg: #ffffffeb; --overlay: #15151966;
  --warn: #936000; --err: #bd1722; color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #171719; --panel: #202023; --panel-2: #27272b; --raise: #303035;
  --ink: #f5f5f7; --muted: #aeafb8; --line: #343439; --line-2: #494950;
  --accent: #ff6971; --accent-ink: #251013; --accent-soft: #ff697115;
  --board: #494746; --board-edge: #a9a4a0; --cell: #242426; --front: #514b45;
  --viewer-bg: #202023; --bar-bg: #202023ef; --overlay: #0009;
  --warn: #e7bd70; --err: #ff8585; color-scheme: dark;
}
body { font-size: 15px; letter-spacing: -.015em; }
h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.13; letter-spacing: -.045em; font-weight: 720; }
h2 { letter-spacing: -.025em; }
button { cursor: pointer; transition: background .16s, border-color .16s, transform .16s; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: default; }
button, input, select { min-height: 44px; }
.primary { background: #d71920; color: white; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
input[type=date] { color-scheme: inherit; }
legend { font-size: .79rem; letter-spacing: .035em; text-transform: none; color: var(--ink); }
label { font-size: .85rem; }
.card { box-shadow: 0 4px 20px #00000003; }
.eyebrow { color: var(--muted); font-size: 10px; letter-spacing: .14em; font-weight: 650; margin: 0 0 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.rail { padding-inline: 12px; gap: 8px; }
.rail .nav { padding: 14px 4px; font-size: 12px; }
.topbar { gap: 20px; }
.top-actions #saveTop { display: none; }
.top-actions .mode button { min-height: 40px; }
.content { max-width: 1640px; width: 100%; align-self: center; padding: 28px; }
.toolbar { padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
#editor { background: var(--panel); border-radius: 20px; border: 1px solid var(--line); margin-top: 12px; }
.section-path { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--muted); }
.section-path button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 13px; }
.page-heading { margin: 8px 0 28px; }
.page-heading p:last-child { margin-bottom: 0; }
.workshop-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.destination { position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 22px; gap: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; color: var(--ink); min-height: 174px; }
.destination:hover { background: var(--panel-2); border-color: var(--line-2); }
.destination svg { width: 29px; height: 29px; margin-bottom: 7px; }
.destination b { font-size: 18px; font-weight: 650; line-height: 1.2; }
.destination small { color: var(--muted); line-height: 1.5; font-size: 13px; font-weight: 400; }
.destination > span:last-child { margin-top: auto; font-size: 18px; width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; }
/* This is a destination screen, not a modal that requires a project. */
.home { left: var(--rail); z-index: 14; overflow-y: auto; display: block; padding: max(32px,env(safe-area-inset-top)) 32px 36px; background: var(--bg); }
.home-card { width: min(760px,100%); margin: 0 auto; display: grid; gap: 20px; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none; text-align: left; }
.home-brand { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.brand-lockup { display: inline-block; width: 180px; position: relative; color: var(--ink); }
.brand-svg { display: block; width: 100%; height: auto; }
.brand-blade { display: none; position: absolute; left: 72%; top: 17%; width: 27%; aspect-ratio: 1; overflow: hidden; clip-path: inset(0 0 50% 0); }
.brand-intro .brand-blade { display: block; }
.brand-blade::after { content: ''; position: absolute; inset: 0; background: url('./brand/saw.svg') center/contain no-repeat; animation: saw-intro 1s cubic-bezier(.2,.65,.3,1) both; }
@keyframes saw-intro { from { transform: rotate(-180deg); } to { transform: rotate(0); } }
.home-sub { font-size: 17px; margin: 10px 0 0; }
.home-room { display: grid; grid-template-columns: 1fr 1.05fr; overflow: hidden; padding: 0; min-height: 205px; border: 0; border-radius: 22px; background: #d71920; color: white; text-align: left; }
.home-room > span { display: flex; flex-direction: column; align-items: flex-start; padding: 24px; gap: 9px; }
.home-room b { font-size: 26px; letter-spacing: -.035em; }
.home-room small { font-size: 14px; line-height: 1.45; font-weight: 400; }
.home-room i { font-style: normal; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #c91520; background: white; font-size: 22px; margin-top: auto; }
.home-room img { width: 100%; height: 100%; object-fit: cover; }
.home-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.home-new { color: var(--accent); border: 1px solid var(--accent); background: transparent; min-height: 50px; font-size: 16px; }
.recent-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.recent-head h2 { font-size: 19px; }
.recent-head button { font-size: 13px; padding: 0; }
.empty-note { font-size: 14px; color: var(--muted); background: var(--panel); padding: 20px; border: 1px dashed var(--line-2); border-radius: 16px; margin: 0; }
.home-btn { background: var(--panel); padding: 16px; border-radius: 18px; }
.home-btn svg { width: 27px; height: 27px; flex-shrink: 0; }
.home-btn .mini svg { width: 100%; height: 100%; }
.trailing { margin-left: auto; }
.home-link { justify-self: start; }
.home-acct { text-align: left; padding-bottom: 8px; }
.skins { grid-template-columns: repeat(3,minmax(0,1fr)); }
.skin { min-width: 0; }
.skin small { line-height: 1.4; }
.measure-head { display: none; }
.room-presentation { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 12px; }
#exitPresentation { display: none; }
body.presenting .rail, body.presenting .topbar, body.presenting .tabs, body.presenting .room-head, body.presenting .room-presentation, body.presenting .room-panel, body.presenting .room-hint { display: none !important; }
body.presenting .app { grid-template-columns: 1fr; }
body.presenting #exitPresentation { display: block; position: fixed; left: 16px; top: max(16px,env(safe-area-inset-top)); z-index: 40; border: 1px solid var(--line); background: var(--panel); color: var(--ink); box-shadow: 0 2px 20px #0002; }
body.presenting .content { padding: 0; max-width: none; }
body.presenting #view-room .room-wrap { margin: 0; }
body.presenting #view-room #roomCanvas { width: 100%; height: 100dvh; border-radius: 0; }
@media (min-width: 761px) {
  .tabs { display: none; }
  .home-shortcuts .destination { min-height: 160px; }
  .sheet .card { padding: 28px; }
}
@media (max-width:760px) {
  :root { --top: 70px; }
  .home { left: 0; padding: max(22px,env(safe-area-inset-top)) 20px calc(100px + env(safe-area-inset-bottom)); }
  .home-card { gap: 14px; }
  .home-brand { margin-bottom: 18px; }
  .brand-lockup { width: 158px; }
  .home-room { min-height: 174px; border-radius: 20px; margin-top: 5px; }
  .home-room > span { padding: 18px; }
  .home-room b { font-size: 23px; }
  .home-room small { font-size: 12px; }
  .home-shortcuts { gap: 12px; }
  .destination { padding: 17px; gap: 8px; min-height: 164px; border-radius: 18px; }
  .destination b { font-size: 17px; }
  .destination small { font-size: 12px; }
  .tabs { z-index: 35; padding-top: 8px; background: var(--bar-bg); }
  .tabs button { font-size: 11px; min-height: 52px; gap: 5px; }
  .tabs button[aria-current="page"] { color: var(--accent); }
  .topbar { gap: 10px; }
  .topbar .logo-mark { display: none; }
  .top-actions { gap: 6px; }
  .top-actions .mode { display: none; }
  .top-actions #quickSave { min-height: 42px; font-size: 13px; padding: 8px 12px; }
  .content { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .workshop-grid { gap: 12px; }
  /* Half-height sheet: dimensions remain within reach and the drawing stays visible. */
  body[data-screen="olcu"] .layout > form {
    position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 24;
    max-height: 47dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line);
    border-radius: 24px 24px 0 0; padding: 0 20px 24px; gap: 20px; box-shadow: 0 -12px 38px #0002;
  }
  body[data-screen="olcu"] main > #view-edit { display: block !important; }
  body[data-screen="olcu"] .measure-head { display: flex; position: sticky; top: 0; padding: 16px 0 10px; align-items: center; justify-content: space-between; background: var(--panel); z-index: 2; }
  .measure-head h2 { font-size: 19px; }
  .measure-head button { padding: 6px 12px; color: var(--accent); background: var(--accent-soft); border: 0; }
  body[data-screen="olcu"] #editor { max-height: 28dvh; }
  .room-head { flex-wrap: wrap; overflow: visible; gap: 6px; }
  .room-head button.ricon { width: auto; padding: 6px 8px; }
  .room-head .ricon span { display: inline; font-size: 11px; }
  .room-head .room-seg { flex: 0 0 100px; }
  #view-room #roomCanvas { height: calc(100dvh - 340px); border-radius: 18px; border: 1px solid var(--line); min-height: 240px; }
  #view-room .room-wrap { margin: 0; }
  .room-panel { max-height: 65%; }
  .shop-grid { grid-template-columns: minmax(0,1fr); }
  .linco-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .brand-blade { display: none !important; }
}
/* Dialogs must remain above persistent navigation. */
.sheet { z-index: 45; }
.brand-intro .brand-original-saw { visibility: hidden; }
.brand-blade { left: 71.6%; top: 21.5%; width: 27.4%; }
@media (prefers-reduced-motion: reduce) { .brand-intro .brand-original-saw { visibility: visible; } }
.home-room { height: 205px; grid-template-rows: minmax(0,1fr); }
.home-room > span, .home-room img { min-height: 0; }
@media (max-width:760px) { .home-room { height: 174px; } }
/* Approved second direction: quiet surfaces and a selection-driven editor. */
.home-room { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.home-room small { color: var(--muted); }
.home-room i { color: var(--panel); background: var(--ink); }
.home-room img { object-position: 42% center; }
.home-new { color: var(--ink); border-color: var(--line-2); }
.home-shortcuts .destination { min-height: 158px; }
.home-room b { font-weight: 700; }
#editor { background: transparent; border: 0; border-radius: 0; margin-top: 0; }
#editor .board.on { stroke: var(--accent); stroke-width: 3px; vector-effect: non-scaling-stroke; }
#editor .part.hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 3px; vector-effect: non-scaling-stroke; }
#editor .grip { fill: var(--panel); }
@media (min-width:761px) { #editor { max-height: 55dvh; } }
#editor .part.on { fill: var(--board); stroke: var(--accent); }

/* Tasarla: çizim + altta sabit araç çubuğu (seçime göre değişir). */
:root { --tabbar-h: 68px; }
.edit-bar { display: grid; gap: 8px; margin-top: 10px; }
.edit-hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; min-height: 1.35em; }
.edit-hint.warn { color: #b26a00; }
.edit-hint.err { color: var(--accent); font-weight: 600; }
.edit-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.editor-actions { display: flex; gap: 6px; flex: none; padding: 0; }
.editor-actions button, #toolbar .icon { width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: 20px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
#toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 0; margin: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
#toolbar > * { flex: none; }
#toolbar button { min-height: 44px; padding: 8px 14px; font-size: 14px; white-space: nowrap; }
#toolbar .primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
#toolbar .sel { color: var(--muted); font-size: 12px; }
#toolbar .pos { display: inline-flex; align-items: center; gap: 4px; position: relative; font-size: 0; }
#toolbar .pos input { width: 88px; min-height: 44px; padding: 6px 30px 6px 10px; font: 600 17px var(--f-body); }
#toolbar .pos span { position: absolute; right: 9px; font-size: 12px; color: var(--muted); }
#toolbar .models { display: inline-flex; gap: 4px; align-items: center; }
.top-actions .dl-top { display: inline-flex; align-items: center; gap: 6px; }
.top-actions .dl-top svg { width: 20px; height: 20px; }
#menuItems button { display: grid; gap: 2px; text-align: left; }
#menuItems button small { color: var(--muted); font-weight: 400; font-size: 12px; }
#menuItems button.danger b { color: var(--accent); }
.cabchip.add { border-style: dashed; position: sticky; right: 0; background: var(--panel); z-index: 1; }
@media (max-width:760px) {
  .top-actions .dl-top { width: 42px; min-height: 42px; padding: 0; justify-content: center; }
  .top-actions .dl-top span { display: none; }
  body[data-screen="edit"] .content { padding-bottom: calc(var(--tabbar-h) + var(--editbar-h, 130px) + env(safe-area-inset-bottom)); }
  body[data-screen="edit"] #editor, body[data-screen="edit"] .edit3d { width: 100%; height: calc(100dvh - 211px - var(--tabbar-h) - var(--editbar-h, 130px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); min-height: 200px; max-height: none; }
  body[data-screen="olcu"] .edit3d { height: 28dvh; min-height: 160px; }
  body[data-screen="edit"] .edit-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 23; margin: 0;
    padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px #0000000d; }
  /* geri / ileri ve seçime göre düğmeler tek akışta sarılır: dar ekranda boş sütun kalmaz */
  body[data-screen="edit"] .edit-row { flex-wrap: wrap; gap: 6px; max-height: 34dvh; overflow-y: auto; overscroll-behavior: contain; }
  body[data-screen="edit"] .editor-actions, body[data-screen="edit"] #toolbar { display: contents; }
  body[data-screen="edit"] #toolbar button { padding: 8px 12px; }
  body[data-screen="edit"] #toolbar .sep { display: none; }
  body[data-screen="edit"] #toolbar .models { flex: 1 1 100%; flex-wrap: wrap; }
  body[data-screen="edit"] #toolbar .models .model { min-width: 42px; width: 42px; min-height: 42px; padding: 4px; }
  .cabchips { scroll-padding-inline-end: 96px; }
  body[data-screen="olcu"] .edit-bar { display: none; }
  .main[inert] .edit-bar { display: none; }
}
