:root {
    --primary-color: #0075FF;
    --primary-hover: #005ECC;
    --danger-color: #E53935;
    --danger-hover: #C62828;
    --light-gray: #f8f9fa;
    --gray: #e9ecef;
    --dark-gray: #6c757d;
    --text-color: #212529;
    --white: #fff;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

/* Small-caps style for the Japanese particle "で" in titles */
.de-mini {
    font-size: 0.7em;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--white);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    line-height: 1.6;
}

/* Visually hidden but accessible (for SEO/AT) */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    border: 0 !important;
    clip: rect(0, 0, 0, 0) !important; /* legacy */
    clip-path: inset(50%) !important;   /* modern */
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

h1 {
    font-weight: 600;
    color: var(--text-color);
    font-size: clamp(1.4rem, 6.5vw, 2.5rem);
    text-align: center;
}

/* Brand wordmark */
.brand-logo {
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    /* gradient text */
    background: linear-gradient(90deg, #0ea5e9 0%, #6366f1 50%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.18));
    position: relative;
}
.brand-logo::after {
    content: '';
    display: block;
    width: 68px;
    height: 3px;
    margin: 6px auto 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #0ea5e9 0%, #6366f1 50%, #a855f7 100%);
    opacity: 0.9;
}
@media (max-width: 480px) {
    .brand-logo { letter-spacing: 0.06em; }
    .brand-logo::after { width: 56px; height: 2px; margin-top: 4px; }
}

/* Logo title image on home */
.logo-title {
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.logo-title picture,
.logo-title picture img {
    display: block;
    margin: 0; /* center via flex on container */
    max-width: 440px;
    width: 100%;
    height: auto;
}
.logo-title .logo-icon {
    display: block;
    width: auto;
    height: 44px;
    margin-right: -40px; /* adjust +20px further apart from logo */
    z-index: 1;
}

/* Home-only title behavior */
body.home h1 {
    white-space: nowrap;
}

/* Slightly tighter top padding on home */
body.home main {
    padding-top: 10px;
}

main > p {
    text-align: center;
    max-width: 580px;
    margin-left: auto;
    margin-right: auto;
}

/* Tighten gap between logo and tagline */
main > p.tagline {
    margin-top: -20px; /* pull tagline up ~20px */
}

/* Icon inside primary buttons */
button .icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Disabled button state */
button:disabled,
button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
button:disabled:hover,
button[aria-disabled="true"]:hover {
    background-color: var(--primary-color);
}

/* Wrapper to show tooltip even when button is disabled */
.tooltip-wrapper {
    display: inline-block;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start; /* align tops of items per row */
    align-content: flex-start; /* keep rows packed from the top */
    gap: 25px;
    background-color: var(--light-gray);
    padding: 25px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    border: 1px solid var(--gray);
}

/* Center specific items (e.g., button groups) on cross-axis */
.control-group--center {
    align-self: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-gray);
}

input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 40px;
    height: 40px;
    background-color: transparent;
    border: none;
    cursor: pointer;
}
input[type="color"]::-webkit-color-swatch {
    border-radius: 50%;
    border: 2px solid var(--gray);
}
input[type="color"]::-moz-color-swatch {
    border-radius: 50%;
    border: 2px solid var(--gray);
}

.control-group-slider {
    width: 160px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--gray);
    border-radius: 5px;
    outline: none;
    transition: opacity .2s;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
    transition: background .2s;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
    border: none;
    transition: background .2s;
}

input[type="range"]:hover::-webkit-slider-thumb {
    background: var(--primary-hover);
}
input[type="range"]:hover::-moz-range-thumb {
    background: var(--primary-hover);
}

#thicknessValue {
    font-size: 14px;
    margin-top: 8px;
    color: var(--text-color);
    font-weight: 600;
}

button {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

#undoButton {
    background-color: var(--danger-color);
}

#undoButton:hover {
    background-color: var(--danger-hover);
}

.canvas-container {
    position: relative;
    width: 100%;
    max-width: 900px; /* Adjust as needed */
    border: 1px solid var(--gray);
    background-color: var(--white);
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
    margin: 0 auto;
}

.canvas-container.drop-target {
    border: 2px dashed var(--primary-color);
    background-color: #f4f9ff;
}



canvas#canvas {
    display: block; /* Remove extra space below canvas */
    width: 100%;
    height: auto;
    background-color: #f0f0f0; /* A light background for the canvas itself */
    border-radius: var(--border-radius);
}

/* Generic content card for static pages */
.content-card {
    width: 100%;
    max-width: 900px;
    background: var(--white);
    border: 1px solid var(--gray);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px 28px;
    box-sizing: border-box;
}

.content-card h1 {
    text-align: left;
    margin: 0 0 0.5em 0;
}

.content-card h2 {
    font-size: 1.2rem;
    margin: 1.2em 0 0.6em;
}

.content-card p {
    margin: 0.6em 0;
}

.content-card ul {
    margin: 0.6em 0 0.6em 0;
    padding-left: 1.2rem;
}

.content-card li {
    list-style: disc;
}

/* Back link on static pages */
.back-link {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
.back-link:hover {
    text-decoration: underline;
}

footer {
    width: 100%;
    background: linear-gradient(180deg, #fafafa 0%, var(--light-gray) 100%);
    padding: 24px 20px;
    text-align: center;
    font-size: 14px;
    color: var(--dark-gray);
    box-sizing: border-box;
    border-top: 1px solid var(--gray);
}
footer p { margin: 6px 0; }
footer a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    opacity: 0.88;
    transition: color .2s ease, opacity .2s ease, text-decoration-color .2s;
}
footer a:hover {
    color: var(--primary-color);
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}
footer a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}
/* Ad block spacing */
.ad-block { margin: 16px 0; text-align: center; }
@media (max-width: 480px) {
    footer { font-size: 13px; padding: 20px; }
}

/* Use Cases Section */
.use-cases {
    width: 100%;
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    box-sizing: border-box;
}

.use-cases h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    color: var(--text-color);
}

.use-cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.case-item {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-align: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.case-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.case-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-bottom: 1px solid var(--gray);
}

.case-item h3 {
    font-size: 1.2rem;
    margin: 20px;
    color: var(--text-color);
}

/* Guide list on the portal page */
.guide-list {
    list-style: none;
    padding: 0;
    margin-top: 1em;
}

.guide-list li {
    border-bottom: 1px solid var(--gray);
}

.guide-list li:last-child {
    border-bottom: none;
}

.guide-list a {
    display: block;
    padding: 1em 0.5em;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    transition: background-color 0.2s ease-in-out;
    border-radius: 8px;
}

.guide-list a:hover {
    background-color: var(--light-gray);
    color: var(--primary-color);
}

.guide-list a::before {
    content: '📄';
    margin-right: 0.8em;
    opacity: 0.8;
}