:root {
    color-scheme: light;
    --ink: #152c25;
    --text: #30483d;
    --muted: #51655b;
    --page: #f6f7f1;
    --surface: #fff;
    --line: #dbe4d9;
    --green: #173b30;
    --accent: #d5f396;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); }
a { color: inherit; }
:focus-visible { outline: 3px solid #528d54; outline-offset: 4px; }
.site-header {
    min-height: 76px;
    padding: 16px max(24px, calc((100% - 1140px) / 2));
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 1rem; font-weight: 700; text-decoration: none; }
.brand img { object-fit: contain; display: block; }
.brand span { white-space: nowrap; }
.placeholder-icon { position: relative; display: inline-grid; place-items: center; }
.placeholder-icon::before { content: ""; width: 48%; height: 35%; border: 2px solid currentColor; border-radius: 4px; }
.placeholder-icon::after { content: ""; position: absolute; width: 16%; height: 16%; border-radius: 50%; background: currentColor; }
.nav-link { font-size: .875rem; font-weight: 650; text-underline-offset: .2em; }
main { width: min(100% - 48px, 1010px); margin: 0 auto; padding: 58px 0 72px; }
.hero { text-align: center; margin: 0 auto 38px; }
h1, h2, p { margin: 0; }
.hero h1 { font-size: clamp(2.25rem, 7vw, 4.85rem); line-height: 1.02; letter-spacing: -.065em; font-weight: 750; }
.hero h1 em { font-family: Georgia, serif; font-weight: 400; color: #315c44; letter-spacing: -.06em; }
.hero p { margin: 20px auto 0; color: var(--muted); max-width: 480px; line-height: 1.6; }
.workspace, .result, .viewer { border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: 0 12px 35px #2038290c; }
.workspace { display: grid; grid-template-columns: .86fr 1.14fr; gap: 16px; padding: 16px; }
.tools { background: var(--green); color: #f6f8eb; padding: 28px; border-radius: 14px; min-width: 0; }
.tools h2, .result h2 { font-size: 1.35rem; letter-spacing: -.035em; }
.tools p { color: #d4e3d9; margin-top: 7px; line-height: 1.55; font-size: .91rem; }
.tools .hint { font-size: .82rem; margin-top: 16px; }
.button {
    min-height: 44px;
    padding: 11px 16px;
    font: inherit;
    font-weight: 680;
    font-size: .9rem;
    border-radius: 9px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background-color .15s;
}
.button:disabled { opacity: .55; cursor: default; }
.tools .button { width: 100%; }
.tools .primary { margin-top: 21px; justify-content: space-between; }
.primary { background: var(--accent); color: #163122; }
.primary:hover:not(:disabled) { background: #e4ffae; }
.secondary { margin-top: 9px; color: #f4f8ef; border-color: #698e7c; background: transparent; }
.secondary:hover:not(:disabled) { background: #235043; }
.dark { color: #fff; background: var(--green); }
.dark:hover:not(:disabled) { background: #245340; }
.outline { color: var(--green); background: #fff; border-color: #aebfb0; }
.outline:hover { background: #f0f4ec; }
.preview-panel {
    display: grid;
    place-items: center;
    min-height: 265px;
    min-width: 0;
    padding: 12px;
    overflow: hidden;
    border: 1px dashed #afc4b2;
    border-radius: 14px;
    background-color: #f4f8f0;
    background-image: radial-gradient(#d4e0d5 1px, transparent 1px);
    background-size: 15px 15px;
}
.preview-panel.dragging { background-color: #e6f5d5; border-color: #43755a; }
.placeholder { display: grid; justify-items: center; gap: 6px; text-align: center; }
.placeholder-icon { color: #2f6347; background: #e5efdf; width: 55px; height: 55px; border: 1px solid #d1e0ca; border-radius: 16px; margin-bottom: 8px; }
.placeholder span:last-child { font-size: .83rem; color: var(--muted); }
.preview-panel img { display: block; width: 100%; max-height: 430px; object-fit: contain; }
.workspace-footer { border-top: 1px solid var(--line); grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 14px 2px 0; gap: 12px; }
.workspace-footer p, .result p, .viewer p, .notice { font-size: .875rem; color: var(--muted); line-height: 1.5; }
.workspace-footer .button { flex: 0 0 auto; }
.result { margin-top: 18px; padding: 22px; }
.result p { margin-top: 5px; }
.link-row { display: flex; gap: 8px; margin-top: 14px; }
.link-row input { flex: 1; min-width: 0; background: #f6f8f3; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; color: var(--text); font: inherit; min-height: 44px; }
.notice { margin-top: 14px; }
.viewer { padding: 20px; }
.viewer-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.viewer h1 { font-size: clamp(1.55rem, 5vw, 2.5rem); line-height: 1.1; letter-spacing: -.045em; margin-bottom: 5px; }
.viewer-image { display: grid; place-items: center; background: #edf1eb; padding: 12px; border-radius: 10px; }
.viewer-image img { display: block; max-width: 100%; max-height: 75vh; height: auto; width: auto; }
.error-page .button { margin-top: 24px; }
@media (max-width: 650px) {
    main { width: min(100% - 30px, 1010px); padding-top: 37px; }
    .site-header { padding-inline: 15px; min-height: 65px; }
    .brand { gap: 8px; font-size: .85rem; }
    .brand img { width: 82px; height: 30px; }
    .nav-link { font-size: .77rem; text-align: right; }
    .hero { margin-bottom: 27px; }
    .hero p { margin-top: 13px; }
    .workspace { grid-template-columns: 1fr; gap: 12px; padding: 12px; border-radius: 18px; }
    .tools { padding: 20px; }
    .preview-panel { min-height: 190px; }
    .workspace-footer { flex-direction: column; align-items: stretch; padding-top: 11px; }
    .link-row { flex-wrap: wrap; }
    .link-row input { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .button { transition: none; } }
