:root {
  --bg: #f6ecd8; --surface: #fffaf0; --surface2: #f2e2c4; --line: #e4cda2;
  --text: #2b1d12; --muted: #786046; --accent: #138267; --accent-ink: #fff;
  --warn: #d97a08; --bad: #d6342a; --gold: #c98a06; --cool: #1978b7; --heat: #e4551c; --co2: #5f6f78;
  --warn-ink: #ab6006; --gold-ink: #875c04; --heat-ink: #c64a18;   /* açık zeminde yazı için (WCAG AA 4,5:1); çubuk/kenar renkleri aynı kalır */
  --shadow: 0 6px 24px rgba(70, 45, 15, .14);
  --r: 18px;
  --chrome: 94px;   /* üst bar + saat çubuğu + boşluklar: sahne en çok 100dvh − bu kadar */
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1e22; --surface: #152c31; --surface2: #1f3b41; --line: #2e5057;
    --text: #f5eedf; --muted: #a2bcb9; --accent: #3ad6a0; --accent-ink: #06201a;
    --warn: #ffb23e; --bad: #ff6f61; --gold: #ffcc4d; --cool: #5cc4ff; --heat: #ff8a4d; --co2: #b9c5cb; --warn-ink: #ffb23e; --gold-ink: #ffcc4d; --heat-ink: #ff8a4d;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #0e1e22; --surface: #152c31; --surface2: #1f3b41; --line: #2e5057;
  --text: #f5eedf; --muted: #a2bcb9; --accent: #3ad6a0; --accent-ink: #06201a;
  --warn: #ffb23e; --bad: #ff6f61; --gold: #ffcc4d; --cool: #5cc4ff; --heat: #ff8a4d; --co2: #b9c5cb; --warn-ink: #ffb23e; --gold-ink: #ffcc4d; --heat-ink: #ff8a4d;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
.app { margin: 0 auto; padding: calc(6px + var(--sat)) max(12px, var(--sar)) calc(8px + var(--sab)) max(12px, var(--sal)); }

/* üst bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 4px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; letter-spacing: .2px; white-space: nowrap; min-width: 0; }
.logo { display: inline-flex; } .logo .mush { width: 26px; height: 26px; }
.mush { display: block; }
.top-r { flex: none; display: flex; align-items: center; gap: 6px; }
.brand b { overflow: hidden; text-overflow: ellipsis; }
.lang-sw { flex: none; display: flex; height: 34px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.lang-sw button { width: 26px; padding: 0; border: 0; background: none; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.lang-sw button.on { background: var(--accent); color: var(--accent-ink); }
.card > .lang-sw { position: absolute; right: 10px; top: 10px; }
.score { display: flex; align-items: baseline; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--surface2); font-variant-numeric: tabular-nums; }
.score span { font-weight: 700; color: var(--gold-ink); }
.score small { color: var(--muted); font-size: 11px; }
.icon { width: 34px; height: 34px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 15px; }

/* aşamalar */
.phases { flex: 1; min-width: 0; display: flex; border-radius: 10px; overflow: hidden; }
.phases span { flex: 1 1 0; min-width: 0; position: relative; display: flex; height: 30px; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.phases span + span { border-left: 1px solid color-mix(in srgb, var(--text) 18%, transparent); }
.phases span[data-p="incubation"] { flex-grow: 3; display: grid; grid-template: 13px 17px / 1fr 1fr; }
.phases span[data-p="fruiting"] { flex-grow: 2; }
.phases span[data-p="incubation"]::before { content: ""; position: absolute; z-index: 1; left: 0; right: 0; top: 13px; height: 1px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.phases span[data-p="incubation"]::after { content: ""; position: absolute; left: 50%; top: 13px; bottom: 0; width: 1px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.phases em { position: relative; grid-column: 1 / -1; text-align: center; font-style: normal; font-size: 10.5px; font-weight: 500; line-height: 13px; }
.phases span.on em { font-weight: 700; }
.phases span[data-p="incubation"] b { font-size: 10.5px; line-height: 17px; }
.phases i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--f, 0)); background: color-mix(in srgb, var(--accent) 55%, var(--surface2)); }
.phases b { position: relative; flex: 1 1 0; min-width: 0; text-align: center; overflow: hidden; font-size: 12.5px; font-weight: 500; line-height: 30px; }
.phases span.on, .phases span.done { color: var(--text); }
.phases span.on b { font-weight: 700; }
.phases span[data-p="incubation"].on b { font-weight: 500; }
.phases span[data-p="incubation"].on b.now { font-weight: 700; }
.phases span.done b::after, .phases span.done em::after, .phases b.ok::after { content: " ✓"; }
.phases span[data-p="incubation"].done b::after { content: none; }
.clockbar { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; padding: 2px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.clockbar .icon { width: 30px; height: 30px; }
.clock { flex: none; display: flex; align-items: center; }
.clock b { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1; }
.icon.speed { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day { flex: none; min-width: 26px; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.day small { font-size: 10px; color: var(--muted); }
.day b { font-size: 22px; font-variant-numeric: tabular-nums; }

/* düzen */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 6px; align-items: start; }
.stage, .panel { min-width: 0; }
.scene-wrap { position: relative; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); background: #143238; aspect-ratio: 16 / 9; max-height: calc(100dvh - var(--chrome) - var(--sat) - var(--sab)); }
#scene { width: 100%; height: 100%; display: block; }
.scene-reset { position: absolute; left: 8px; top: 8px; color: var(--text); cursor: pointer; }
.scene-reset[hidden] { display: none; }
.toasts { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: none; }
.toast { padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: rgba(20, 16, 12, .78); color: #fff; animation: tin .25s ease, tout .4s ease 2.6s forwards; }
.toast.bad { background: rgba(190, 50, 40, .9); }
.toast.good { background: rgba(40, 140, 85, .9); }
.toast.gold { background: rgba(200, 145, 20, .95); color: #1d1406; }
@keyframes tin { from { opacity: 0; } }
@keyframes tout { to { opacity: 0; } }

.stats { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.stat { flex: none; max-width: 100%; display: flex; align-items: baseline; gap: 4px; height: 26px; padding: 3px 7px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; position: relative; min-width: 0; overflow: hidden; white-space: nowrap; transition: border-color .3s; }
.stat small { flex: 0 1 auto; min-width: 0; color: var(--muted); font-size: 11.5px; line-height: 18px; overflow: hidden; text-overflow: ellipsis; }
.stat b { flex: none; font-size: 14px; line-height: 18px; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.stat i { flex: 0 1 auto; min-width: 0; font-style: normal; font-size: 11px; line-height: 18px; color: var(--muted); font-variant-numeric: tabular-nums; overflow: hidden; }
.stat em { flex: none; font-style: normal; font-size: 11px; line-height: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat.ok { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.stat.warn { border-color: var(--warn); }
.stat.bad { border-color: var(--bad); }
.stat.ok b { color: var(--accent); }
.stat.warn b { color: var(--warn-ink); }
.stat.bad b { color: var(--bad); }
#stYield b { color: var(--gold-ink); }
#stHeat b { color: var(--heat-ink); }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--surface2); }
.bar span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s linear; }
.bar.gold span { background: var(--gold); }
.bar.heat span { background: var(--heat); }
.stat.hide { display: none; }

/* panel */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px; box-shadow: var(--shadow); }
.ctl label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.ctl output { color: var(--text); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.ctl.sw { display: flex; align-items: center; gap: 12px; }
.ctl.sw label { flex: 1; }
input.sw { -webkit-appearance: none; appearance: none; flex: none; width: 46px; height: 26px; margin: 0; border-radius: 99px; background: var(--surface2); position: relative; cursor: pointer; transition: background .15s; }
input.sw::after { content: ''; position: absolute; top: 1px; left: 1px; width: 24px; height: 24px; box-sizing: border-box; border-radius: 50%; background: var(--surface); border: 3px solid var(--muted); box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: left .15s; }
input.sw:checked { background: var(--gold); }
input.sw:checked::after { left: 21px; border-color: var(--gold); }
input.sw:disabled { opacity: .5; cursor: default; }
#outLight.on { color: var(--gold-ink); }
.ctl output.ok { color: var(--accent); }
.ctl output.warn { color: var(--warn-ink); }
.ctl output.bad { color: var(--bad); }
#inRoom, #qRoom { --tone: var(--heat); }
#inRh, #qRh { --tone: var(--cool); }
#inCo2, #qCo2 { --tone: var(--co2); }
#outRoom, #qRoomOut { color: var(--heat-ink); }
#outRh, #qRhOut { color: var(--cool); }
#outCo2, #qCo2Out { color: var(--co2); }
input[type=range] { --tone: var(--accent); -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 0; display: block; touch-action: pan-y; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--tone) var(--fill, 50%), var(--surface2) var(--fill, 50%)); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 99px; background: var(--surface2); }
input[type=range]::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--tone); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -8px; border-radius: 50%; background: var(--surface); border: 3px solid var(--tone); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--tone); }
input[type=range]:disabled { filter: grayscale(1); }

.btn { border: 0; border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 52px; font-weight: 700; transition: transform .1s, filter .2s, opacity .2s; }
.btn[hidden] { display: none; }
.btn:active { transform: scale(.97); }
.btn small { font-weight: 500; font-size: 11px; opacity: .85; }
.btn.go { background: var(--accent); color: var(--accent-ink); font-size: 16px; }
.btn.go small { font-size: 13px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.wide { width: 100%; }
.btn:disabled.go { opacity: .5; }


/* modallar */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: max(16px, var(--sat)) max(16px, var(--sar)) max(16px, var(--sab)) max(16px, var(--sal)); background: rgba(10, 8, 6, .7); animation: fade .25s ease; }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.card { position: relative; width: min(440px, 100%); max-height: calc(100dvh - max(16px, var(--sat)) - max(16px, var(--sab))); overflow: auto; overscroll-behavior: contain; background: var(--surface); border-radius: 24px; padding: 22px 20px; box-shadow: var(--shadow); text-align: center; }
@keyframes pop { from { opacity: 0; } }
.card h1 { margin: 4px 0 6px; font-size: 26px; }
.card h2 { margin: 2px 0 10px; font-size: 20px; }
.card h2.q { font-size: 16px; margin: 0 0 10px; }
.card .ctl { text-align: left; margin-bottom: 8px; }
.big-logo { display: flex; justify-content: center; } .big-logo .mush { width: 64px; height: 64px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 16px; }
.chips span { font-size: 12px; padding: 4px 9px; border-radius: 99px; background: var(--surface2); }
.card .btn + .btn { margin-top: 8px; }
.rules { text-align: left; width: min(560px, 100%); }
.rules table { border-collapse: collapse; width: 100%; font-size: 13px; }
.rules th { text-align: left; vertical-align: top; padding: 7px 8px 7px 0; white-space: nowrap; color: var(--accent); }
.rules td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.rules tr:last-child td { border-bottom: 0; }
.fine { font-size: 11.5px; color: var(--muted); margin: 10px 0 0; }
.close { position: sticky; top: -8px; z-index: 3; float: right; margin: -12px -10px 0 8px; box-shadow: 0 0 0 4px var(--surface); }
.end-icon { font-size: 48px; display: flex; justify-content: center; line-height: 1; } .end-icon .mush { width: 52px; height: 52px; }
.end-why { margin: 0 0 6px; font-size: 14px; line-height: 1.35; }
.card h2.win { font-size: 24px; line-height: 1.2; }
.end-yield[hidden] { display: none; }
.end-yield { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin: 4px 0; }
.end-yield b { font-size: 56px; line-height: 1; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.end-yield span { color: var(--muted); }
.end-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.end-meta div { background: var(--surface2); border-radius: 14px; padding: 6px; }
.end-meta small { display: block; font-size: 11px; color: var(--muted); }
.end-meta b { font-variant-numeric: tabular-nums; }
.card.end { width: min(560px, 100%); }
.end-icon.lost .mush { filter: grayscale(1); opacity: .6; }
.ec { --lab: 128px; position: relative; display: grid; grid-template-columns: var(--lab) minmax(0, 1fr); gap: 2px 4px; margin: 8px 0 12px; text-align: left; font-size: 10.5px; line-height: 13px; color: var(--muted); }
.ec-l { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; white-space: nowrap; }
.ec-l span { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ec-l em { font-style: normal; color: var(--muted); }
.ec-l b { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--bad); }
.ec-l small { flex: none; align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; text-align: right; font-size: 9.5px; line-height: 10px; font-variant-numeric: tabular-nums; }
.ec-l small i { font-style: normal; }
.ec-l.ax span { margin-left: auto; color: var(--muted); }
.ec-p { position: relative; min-width: 0; }
.ec-p svg { display: block; width: 100%; height: 100%; }
.ec-ph, .ec-ax { height: 12px; overflow: hidden; font-size: 9.5px; line-height: 12px; }
.ec-ph span { position: absolute; top: 0; text-align: center; overflow: hidden; white-space: nowrap; font-weight: 600; }
.ec-ax span { position: absolute; top: 0; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.ec-line { height: 42px; background: var(--surface2); border-radius: 6px; overflow: hidden; }
.ec-line polyline { fill: none; stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.ec-line .core { stroke: var(--heat); }
.ec-line .co2 { stroke: var(--cool); }
.ec-line .lim { stroke: var(--bad); stroke-opacity: .45; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.ec-cells { height: 13px; }
.ec-cells rect { fill: var(--surface2); }
.ec-cells rect.on { fill: var(--bad); }
.ec-o { position: absolute; top: 0; bottom: 0; left: calc(var(--lab) + 4px); right: 0; touch-action: pan-y; }
.ec-o i { position: absolute; top: 0; bottom: 0; width: 1px; background: color-mix(in srgb, var(--text) 28%, transparent); }
.ec-cur { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--text) 14%, transparent); }
.ec-tip { position: absolute; bottom: calc(100% + 2px); z-index: 2; width: max-content; max-width: 100%; padding: 3px 7px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 12px; line-height: 15px; pointer-events: none; }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .scene-wrap { aspect-ratio: 16 / 9; max-height: none; }
}
@media (max-width: 600px) {
  .clockbar { flex-wrap: wrap; row-gap: 2px; }
  .clock { margin-right: auto; }
  .phases { order: 5; flex: 0 0 100%; }
  .phases b { font-size: 11.5px; }
}
@media (max-width: 520px) {
  .app { padding: calc(4px + var(--sat)) max(6px, var(--sar)) calc(6px + var(--sab)) max(6px, var(--sal)); }
  .brand b { font-size: 16px; }
  .top { padding-bottom: 3px; }
  .clock b { font-size: 18px; }
  .scene-wrap { aspect-ratio: 16 / 9.5; }
  .grid { gap: 4px; }
  .panel { padding: 4px 8px; }
  .ctl label { font-size: 12.5px; }
  .ctl output { font-size: 15px; }
  .btn { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 340px) {
  .phases b.ok::after, .phases span.done b::after, .phases span.done em::after { content: none; }
}
@media (max-width: 400px) {
  .score small { display: none; }
  .icon { width: 32px; height: 32px; }
  .lang-sw { height: 32px; }
  html[lang="en"] .brand .logo { display: none; }
  html[lang="en"] .brand b { font-size: 14.5px; }
  .top-r { gap: 4px; }
}

.toasts { top: auto; bottom: 8px; align-items: flex-start; }

/* dokunmatik / dar ekran: dokunma hedefleri en az 44 px */
@media (pointer: coarse), (max-width: 860px) {
  :root { --chrome: 116px; }
  .icon, .clockbar .icon { width: 44px; height: 44px; font-size: 17px; }
  .icon.speed { font-size: 14px; }
  .lang-sw { height: 44px; border: 0; box-shadow: 0 0 0 1px var(--line); }
  .lang-sw button { width: 36px; font-size: 12.5px; }
  .scene-reset { width: 44px; height: 44px; }
  input[type=range] { height: 44px; margin: -7px 0; }
  input[type=range]::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -10px; }
  input[type=range]::-moz-range-thumb { width: 22px; height: 22px; }
  .ctl.sw { min-height: 40px; }
  .ctl.sw label { align-self: stretch; align-items: center; }
  input.sw::before { content: ''; position: absolute; inset: -9px -4px; }
  .card .ctl { margin-bottom: 10px; }
}
/* telefon: başlık yazısı yerine yalnız logo (puan büyüyünce yazı kırpılıyordu) */
@media (max-width: 480px) {
  .brand b { display: none; }
  html[lang="en"] .brand .logo { display: inline-flex; }
  .logo .mush { width: 30px; height: 30px; }
  .rules { padding: 18px 14px; }
  .rules tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .rules tr:last-child { border-bottom: 0; }
  .rules th, .rules td { display: block; padding: 0; border: 0; white-space: normal; }
}
/* 3B: oda ön açıklığı 2:1; kutu da 2:1 olur, üstte/altta boş bant kalmaz */
.scene-wrap.s3d { aspect-ratio: 2 / 1; }
/* yatay telefon: sahne ve panel yan yana, sahne ekrana sığar */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 560px) {
  .grid { grid-template-columns: minmax(0, 1fr) 264px; }
  .scene-wrap, .scene-wrap.s3d { aspect-ratio: auto; height: calc(100dvh - var(--chrome) - var(--sat) - var(--sab)); min-height: 180px; max-height: none; }
  .panel { padding: 2px 10px 6px; }
  .card { padding: 14px 18px; }
  .big-logo { display: none; }
  .card h1 { font-size: 20px; margin: 0 0 2px; }
  .card h2.q { font-size: 14px; margin: 0 84px 6px; }
  .card .ctl { margin-bottom: 4px; }
  #mStart .card { width: min(560px, 100%); display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; }
  #mStart .card > * { grid-column: 1 / -1; }
  #mStart .card > .btn { grid-column: auto; margin-top: 4px; }
  #mStart .card > .btn:has(+ .btn[hidden]) { grid-column: 1 / -1; }
}
/* Koyu temada dolu aşama çubuğu daha koyu: üstündeki aşama adı 4,5:1 kontrastı tutar */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .phases i { background: color-mix(in srgb, var(--accent) 30%, var(--surface2)); } }
:root[data-theme="dark"] .phases i { background: color-mix(in srgb, var(--accent) 30%, var(--surface2)); }

/* ---- tür seçimi ve kültür mantarı (Agaricus) kontrolleri: html[data-species] ile açılır ---- */
:root:not([data-species="agaricus"]) .ag { display: none !important; }
:root[data-species="agaricus"] .pl { display: none !important; }
.phases[hidden] { display: none; }
.phases.ag4 span[data-p="spawnrun"] { flex-grow: 3; }
.phases.ag4 span { flex-grow: 2; }
.seg { display: flex; margin: 0 0 10px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg button { flex: 1 1 0; min-width: 0; min-height: 36px; padding: 4px 6px; border: 0; background: none; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
#inCompost, #qCompost, #inCasing, #qCasing { --tone: var(--cool); }
#outCompost, #qCompostOut, #outCasing, #qCasingOut { color: var(--cool); }
.ops { flex: none; display: flex; gap: 4px; }
.op { min-width: 0; height: 28px; padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12.5px; font-weight: 700; line-height: 1; white-space: nowrap; }
.op:active:not(:disabled) { transform: scale(.96); }
.op:disabled { cursor: default; color: var(--muted); opacity: .55; }
.op[aria-pressed="true"] { opacity: 1; color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.op[aria-pressed="true"].warn { color: var(--surface); background: var(--warn-ink); border-color: var(--warn-ink); }
/* Zamanı gelmiş, henüz yapılmamış işlem: yeşil zamanında, turuncu kayıpsız son gün, kırmızı verim düşüyor (oyun beklemez) */
.op[aria-pressed="false"].ok { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.op[aria-pressed="false"].warn { color: var(--warn-ink); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, var(--surface)); }
.op[aria-pressed="false"].bad { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
/* Aynı ipucu aşama çubuğunda ve ilerleme kutusunda: sarım tamam (dolu) ama işlem bekliyorsa dolgu turuncu → kırmızı olur */
.phases.ag4 span.warn i { background: color-mix(in srgb, var(--warn) 45%, var(--surface2)); }
.phases.ag4 span.bad i { background: color-mix(in srgb, var(--bad) 45%, var(--surface2)); }
:root[data-species="agaricus"] #stProg.warn .bar span { background: var(--warn); }
:root[data-species="agaricus"] #stProg.bad .bar span { background: var(--bad); }
:root[data-species="agaricus"] .ctl.sw { gap: 6px; }
@media (pointer: coarse), (max-width: 860px) {
  .op { height: 40px; min-width: 40px; padding: 0 8px; font-size: 13px; }
  .seg button { min-height: 44px; }
}
/* Tür seçimi oyunda gösterilmez: tür, VPDew'deki oyun düğmesinin adresiyle (?species=) gelir */
#spPick[hidden] { display: none !important; }
/* Agaricus sonuç grafiği: son aşama (Meyve, 4 gün) ve son gün etiketi dar ekranda kesilmesin */
:root[data-species="agaricus"] .ec-ph span:last-child { overflow: visible; display: flex; justify-content: flex-end; }
:root[data-species="agaricus"] .ec-ax span:last-child { left: auto !important; right: 0; transform: none; }
:root[data-species="agaricus"] .ec-ph span:nth-last-child(2):not(:first-child) { text-align: left; }
