:root {
    color-scheme: light;
    --bg: #ecebe7;
    --panel: #f8f7f3;
    --panel-2: #ffffff;
    --ink: #171816;
    --muted: #70736c;
    --line: #d7d6d0;
    --line-dark: #b7b7b1;
    --accent: #116b4b;
    --accent-dark: #0c523a;
    --accent-soft: #dcebe4;
    --danger: #a53a2c;
    --warning: #8a6414;
    --shadow: 0 18px 50px rgba(30, 31, 28, .08);
    --radius: 14px;
    font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { min-width: 320px; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-rows: 64px 1fr 52px; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(248,247,243,.92); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 750; text-decoration: none; letter-spacing: -.04em; font-size: 22px; }
.brand span { color: var(--accent); }
.mode-switch { display: flex; background: #e2e1dc; padding: 4px; border-radius: 9px; gap: 2px; }
.mode-btn { border: 0; background: transparent; border-radius: 6px; padding: 8px 13px; cursor: pointer; font-weight: 650; font-size: 14px; color: var(--muted); }
.mode-btn.is-active { background: var(--panel-2); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 16px; }
.counter { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.counter strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; box-shadow: 0 0 0 3px var(--accent-soft); }
.lang-btn, .text-btn { border: 0; background: none; cursor: pointer; font-weight: 700; padding: 6px; }
.lang-btn { border-left: 1px solid var(--line); padding-left: 15px; }
.text-btn { color: var(--accent); }
.text-btn:disabled { opacity: .35; cursor: default; }
.workspace { padding: 18px; min-height: 0; }
.panel-view { display: none; height: calc(100vh - 152px); grid-template-columns: 270px minmax(420px, 1fr) 300px; grid-template-rows: minmax(0, 1fr) 72px; gap: 10px; max-width: 1540px; margin: 0 auto; }
.panel-view.is-active { display: grid; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.left-panel, .right-panel, .editor-panel { min-height: 0; overflow: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 17px; margin: 2px 0 0; letter-spacing: -.02em; }
.eyebrow { font: 700 10px/1.2 "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; color: var(--muted); letter-spacing: .12em; }
.upload-zone { margin: 16px; border: 1.5px dashed var(--line-dark); min-height: 168px; border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; cursor: pointer; background: var(--panel-2); transition: border-color .15s, background .15s; }
.upload-zone:hover, .upload-zone.is-dragover { border-color: var(--accent); background: #f2f7f4; }
.upload-zone strong { font-size: 14px; }
.upload-zone span, .upload-zone small { color: var(--muted); font-size: 12px; }
.upload-zone small { margin-top: 7px; font: 600 10px "IBM Plex Mono", monospace; letter-spacing: .05em; }
.upload-icon { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 20px; margin-bottom: 5px; }
.settings { padding: 2px 18px 18px; }
.settings.is-disabled { opacity: .42; pointer-events: none; }
.control-row { display: flex; align-items: center; justify-content: space-between; margin-top: 17px; font-size: 13px; font-weight: 650; }
.control-row.compact { margin-top: 0; }
.control-row output { color: var(--muted); font: 600 11px "IBM Plex Mono", monospace; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin-top: 8px; }
.control-group { margin-top: 19px; padding-top: 18px; border-top: 1px solid var(--line); }
.control-group > label { font-size: 13px; font-weight: 650; }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 9px; }
.segment { height: 34px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 7px; cursor: pointer; font-size: 11px; overflow: hidden; }
.segment.is-active { outline: 2px solid var(--accent); outline-offset: 1px; }
.segment[data-bg="#111111"] { background: #111; color: white; }
.color-segment { padding: 3px; }
.color-segment input { width: 100%; height: 100%; border: 0; padding: 0; background: none; cursor: pointer; }
.switch { display: inline-flex; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 37px; height: 21px; border-radius: 12px; background: #c8c8c3; position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%; top: 2px; left: 2px; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.hint { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 8px 0 0; }
.secondary-btn, .primary-btn { border: 1px solid var(--line-dark); border-radius: 8px; min-height: 40px; padding: 0 14px; cursor: pointer; font-weight: 700; }
.secondary-btn { background: var(--panel-2); width: 100%; margin-top: 19px; }
.primary-btn { background: var(--accent); color: white; border-color: var(--accent); display: inline-flex; align-items: center; justify-content: center; gap: 14px; }
.primary-btn:hover { background: var(--accent-dark); }
.primary-btn:disabled { background: #a5aaa5; border-color: #a5aaa5; cursor: default; }
.primary-btn kbd { font: 700 10px "IBM Plex Mono", monospace; padding: 3px 5px; border: 1px solid rgba(255,255,255,.4); border-radius: 4px; }
.editor-panel { display: flex; flex-direction: column; }
.editor-head { align-items: center; }
.privacy-note { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 8px; }
.canvas-stage { margin: auto; width: min(72vh, 720px); aspect-ratio: 1 / 1; height: auto; flex: 0 0 auto; max-width: calc(100% - 54px); position: relative; background-color: white; background-image: linear-gradient(45deg,#ededed 25%,transparent 25%), linear-gradient(-45deg,#ededed 25%,transparent 25%), linear-gradient(45deg,transparent 75%,#ededed 75%), linear-gradient(-45deg,transparent 75%,#ededed 75%); background-size: 22px 22px; background-position: 0 0,0 11px,11px -11px,-11px 0; border: 1px solid var(--line-dark); box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); overflow: hidden; touch-action: none; cursor: grab; }
.canvas-stage:active { cursor: grabbing; }
.canvas-stage.is-empty { cursor: pointer; }
.canvas-stage.is-empty:hover { border-color: var(--accent); }
#editorCanvas { width: 100%; height: 100%; display: block; aspect-ratio: 1 / 1; }
.canvas-placeholder[hidden] { display: none !important; }
.canvas-placeholder { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 30px; pointer-events: none; }
.canvas-placeholder strong { font-size: 14px; color: var(--ink); margin-top: 12px; }
.placeholder-mark { width: 72px; height: 72px; border: 1px solid var(--line-dark); display: grid; place-items: center; font-size: 32px; font-weight: 800; border-radius: 13px; background: rgba(255,255,255,.84); color: var(--ink); }
.canvas-placeholder p { max-width: 260px; font-size: 13px; line-height: 1.5; }
.safe-area { position: absolute; width: 80%; height: 80%; left: 10%; top: 10%; border: 1px dashed rgba(17,107,75,.65); border-radius: 50%; pointer-events: none; }
.stage-help { text-align: center; color: var(--muted); font-size: 11px; padding: 12px 18px 16px; }
.browser-preview { margin: 16px; border: 1px solid var(--line); background: #e9e9e6; border-radius: 9px; padding: 8px 8px 0; }
.browser-chrome { display: flex; gap: 4px; margin: 0 0 7px 2px; }
.browser-chrome i { width: 6px; height: 6px; border-radius: 50%; background: #b5b5b0; }
.browser-tab { width: 78%; min-width: 180px; height: 36px; background: white; display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 8px; padding: 0 9px; border-radius: 7px 7px 0 0; font-size: 11px; }
.browser-tab canvas { width: 16px; height: 16px; }
.browser-tab b { color: var(--muted); font-weight: 400; }
.size-previews { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0 16px 16px; }
.size-card { min-height: 76px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; }
.size-card span { color: var(--muted); font: 600 9px "IBM Plex Mono", monospace; }
.size-card canvas.checker { image-rendering: pixelated; }
.size-card.large { min-height: 104px; grid-column: span 1; }
.size-card.large canvas { width: 50px; height: 50px; }
.size-card canvas.ios { border-radius: 11px; }
.size-card canvas.android { border-radius: 50%; }
.output-list { margin: 0 16px 16px; border-top: 1px solid var(--line); }
.output-list div { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); min-height: 37px; font-size: 11px; }
.output-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.output-list b { color: var(--muted); font: 600 9px "IBM Plex Mono", monospace; white-space: nowrap; }
.generate-bar { grid-column: 1 / -1; border: 1px solid var(--line-dark); border-radius: var(--radius); background: #1d201d; color: white; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 14px 12px 20px; box-shadow: var(--shadow); }
.generate-copy { display: flex; flex-direction: column; gap: 3px; }
.generate-copy strong { font-size: 14px; }
.generate-copy span { color: #b8bcb8; font-size: 11px; }
.generate-bar .primary-btn { min-width: 220px; }
.checker-view { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.checker-card { width: min(760px, 100%); margin: auto; padding: 38px; }
.checker-card h1 { font-size: clamp(28px, 4vw, 48px); letter-spacing: -.045em; margin: 10px 0 12px; }
.checker-card > p { color: var(--muted); max-width: 590px; line-height: 1.55; }
.checker-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 26px; }
.checker-form input { height: 46px; border: 1px solid var(--line-dark); background: white; border-radius: 8px; padding: 0 13px; color: #111; outline: none; }
.checker-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.checker-status { margin-top: 22px; padding: 12px 14px; background: #ecece8; border-radius: 8px; font-size: 13px; }
.checker-results { margin-top: 12px; }
.result-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 9px; min-height: 46px; border-bottom: 1px solid var(--line); font-size: 13px; }
.result-icon { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: #e0e1dd; }
.result-row.ok .result-icon { background: var(--accent-soft); color: var(--accent-dark); }
.result-row.missing .result-icon { background: #f3e4df; color: var(--danger); }
.result-detail { color: var(--muted); font: 600 10px "IBM Plex Mono", monospace; }
.checker-generate { width: auto; margin-top: 22px; }
.footer { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); background: var(--panel); }
.footer div { display: flex; gap: 8px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); }
@media (max-width: 1050px) {
    .panel-view { height: auto; grid-template-columns: 240px 1fr; grid-template-rows: auto auto auto; }
    .right-panel { grid-column: 1 / -1; }
    .size-previews { grid-template-columns: repeat(5, 1fr); }
    .generate-bar { position: sticky; bottom: 8px; }
}
@media (max-width: 760px) {
    .app-shell { grid-template-rows: auto 1fr auto; }
    .topbar { grid-template-columns: 1fr auto; padding: 11px 14px; gap: 9px; }
    .mode-switch { grid-column: 1 / -1; grid-row: 2; }
    .mode-btn { flex: 1; }
    .counter span:last-child { display: none; }
    .workspace { padding: 8px; }
    .panel-view { display: none; grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
    .panel-view.is-active { display: grid; }
    .left-panel, .editor-panel, .right-panel { grid-column: 1; }
    .editor-panel { min-height: 500px; }
    .canvas-stage { width: calc(100vw - 54px); }
    .size-previews { grid-template-columns: repeat(3, 1fr); }
    .generate-bar { flex-direction: column; align-items: stretch; }
    .generate-bar .primary-btn { width: 100%; min-width: 0; }
    .checker-card { padding: 24px 18px; }
    .checker-form { grid-template-columns: 1fr; }
    .footer { min-height: 60px; padding: 12px 14px; flex-direction: column; justify-content: center; gap: 7px; }
    .privacy-note { display: none; }
}
@media (prefers-color-scheme: dark) {
    :root { color-scheme: dark; --bg:#141614; --panel:#1d1f1c; --panel-2:#242723; --ink:#f1f2ee; --muted:#a5aaa2; --line:#343833; --line-dark:#4b504a; --accent:#5bb58d; --accent-dark:#479b76; --accent-soft:#213a2f; --shadow:0 18px 50px rgba(0,0,0,.18); }
    .topbar { background: rgba(29,31,28,.92); }
    .mode-switch { background:#111310; }
    .mode-btn.is-active { background:#2b2e29; }
    .upload-zone:hover, .upload-zone.is-dragover { background:#1e2923; }
    .segment[data-bg="#ffffff"] { background:#fff; color:#111; }
    .checker-form input { background:#111310; color:#f4f4f1; }
    .canvas-stage { background-color:#f8f8f6; }
    .browser-preview { background:#161815; }
    .browser-tab { background:#2a2d28; }
    .checker-status { background:#262925; }
}
