:root {
    --bg: #0f1419;
    --surface: #1a222c;
    --border: #2d3a47;
    --text: #e7ecf1;
    --muted: #8b9aab;
    --accent: #3d9cf5;
    --accent-hover: #5eb0ff;
    --danger: #f07178;
    --radius: 10px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
    --max: 72rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.site-wrap {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.site-header__inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0.875rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.site-logo {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text);
    text-decoration: none;
}

.site-logo:hover {
    color: var(--accent);
    text-decoration: none;
}

.site-logo img {
    display: block;
    height: 2rem;
    width: auto;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
}

.site-nav a {
    font-size: 0.9375rem;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1.25rem 1rem;
    margin-top: auto;
}

.site-footer__inner {
    max-width: var(--max);
    margin: 0 auto;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted);
}

.hero {
    text-align: center;
    padding: 2rem 0 1.5rem;
}

.hero h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
}

.hero p {
    margin: 0 auto;
    max-width: 36rem;
    color: var(--muted);
    font-size: 1rem;
}

/* Optional hero image: see README "Image assets (manual)" */
.hero__visual {
    margin: 1.5rem auto 0;
    max-width: min(100%, 520px);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.hero__visual img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

.tool-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    margin-top: 1.5rem;
}

.tool-card {
    display: block;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    transition:
        border-color 0.15s ease,
        transform 0.15s ease;
}

.tool-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.tool-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.0625rem;
}

.tool-card p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
}

.tool-card__thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: calc(var(--radius) - 4px);
    margin-bottom: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
}

.tool-page h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.5rem, 3vw, 1.85rem);
}

.tool-intro {
    color: var(--muted);
    margin: 0 0 1.5rem;
    max-width: 42rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.panel h2 {
    margin: 0 0 1rem;
    font-size: 1.125rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.875rem;
    color: var(--muted);
}

input[type="text"],
input[type="number"],
input[type="file"],
select,
textarea {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

textarea {
    width: 100%;
    min-height: 12rem;
    resize: vertical;
    font-family:
        ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
    font-size: 0.8125rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font: inherit;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: var(--accent);
    color: #0a0e12;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
}

.btn--ghost:hover {
    border-color: var(--accent);
    background: rgba(61, 156, 245, 0.08);
}

.preview-wrap {
    margin-top: 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.preview-wrap img,
.preview-wrap canvas {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.msg {
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

.msg--error {
    color: var(--danger);
}

.msg--ok {
    color: #7fd99a;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (min-width: 640px) {
    main {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}
