:root {
    --bg: #faf9f6;
    --surface: #ffffff;
    --surface-soft: #f3f6f7;
    --text: #18212b;
    --muted: #6d7680;
    --line: #e4e7e9;
    --accent: #315f69;
    --accent-hover: #254c54;
    --accent-soft: #e9f0f1;
    --warm-soft: #f5f1e8;
    --shadow: 0 12px 32px rgba(20, 31, 38, 0.06);
    --radius: 18px;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Hiragino Sans",
        "Yu Gothic",
        "Meiryo",
        sans-serif;
    line-height: 1.7;
}

.site-header {
    background: rgba(250, 249, 246, 0.96);
    border-bottom: 1px solid var(--line);
}

.site-brand {
    color: var(--text);
    font-family:
        Georgia,
        "Times New Roman",
        "Yu Mincho",
        serif;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
}

.site-brand:hover {
    color: var(--accent);
}

.page-shell {
    min-height: 70vh;
}

.hero {
    max-width: 780px;
    margin: 0 auto 3.5rem;
    text-align: center;
}

.hero-title {
    margin-bottom: 1rem;
    font-family:
        Georgia,
        "Times New Roman",
        "Yu Mincho",
        serif;
    font-size: clamp(1.9rem, 4vw, 3rem);
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.015em;
}

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

.artwork-card {
    height: 100%;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}


.artwork-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 1.25rem;
    background: #f1f1ef;
    overflow: hidden;
}

.artwork-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 180ms ease;
}


.price-area {
    padding: 1.1rem 1.2rem 1.3rem;
}

.price-input-group {
    overflow: hidden;
    border: 1px solid #cfd5d8;
    border-radius: 12px;
    background: var(--surface);
}

.example-price-unit[hidden],
.price-field-error[hidden] {
    display: none !important;
}

/* Field-specific validation appears directly below the corresponding amount. */
.price-field-error {
    margin: 0.55rem 0 0;
    color: #8a3026;
    font-size: 0.86rem;
    line-height: 1.5;
}

.price-input-group.is-invalid,
.price-input-group.is-invalid:focus-within {
    border-color: #a74436;
}

.price-input {
    min-height: 50px;
    background: transparent;
    border: 0;
    box-shadow: none !important;
    font-size: 1.05rem;
}

.price-input:focus {
    background: transparent;
}

/* Currency is a hint inside an empty input, not a permanent prefix. */
.price-input::placeholder {
    color: var(--muted);
    opacity: 0.65;
    font-weight: 400;
}

.price-input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(49, 95, 105, 0.12);
}

.submit-area {
    margin-top: 3rem;
    text-align: center;
}

.primary-action {
    min-width: min(360px, 100%);
    padding: 0.9rem 2rem;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: #fff;
    font-weight: 600;
    transition:
        background 160ms ease,
        transform 160ms ease;
}

.primary-action:hover,
.primary-action:focus {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
}

.primary-action:disabled {
    opacity: 0.65;
    transform: none;
}

.example-panel {
    max-width: 760px;
    margin: 4rem auto 0;
    padding: 1.5rem;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.example-title {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}

.example-values {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
}

.example-chip {
    padding: 0.4rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.9rem;
}

.results-header {
    max-width: 760px;
    margin: 0 auto 3.5rem;
    text-align: center;
}

.results-title {
    font-family:
        Georgia,
        "Times New Roman",
        serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 500;
}

.result-section {
    padding: 2rem;
    border-radius: 24px;
}

.result-section-recommended {
    background: var(--warm-soft);
}

.result-section-contrasting {
    background: var(--accent-soft);
}

.result-section-title {
    margin-bottom: 1.75rem;
    font-family:
        Georgia,
        "Times New Roman",
        "Yu Mincho",
        serif;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 500;
}

.result-col {
    width: 20%;
}

.result-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(24, 33, 43, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(20, 31, 38, 0.05);
}

.result-image-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 0.75rem;
    background: #f1f1ef;
    overflow: hidden;
}

.result-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 1rem;
}

.result-title {
    margin-bottom: 0.4rem;
    font-family:
        Georgia,
        "Times New Roman",
        serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.result-creator {
    min-height: 2.6em;
    margin-bottom: 0.75rem;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.result-museum {
    margin-top: auto;
    margin-bottom: 0.9rem;
    font-size: 0.82rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.external-link {
    display: inline-block;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--accent);
    border-radius: 10px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.external-link:hover {
    background: var(--accent);
    color: #fff;
}

.survey-panel {
    max-width: 860px;
    margin: 4rem auto 0;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.secondary-action {
    display: inline-block;
    padding: 0.75rem 1.3rem;
    border: 1px solid #b9c0c4;
    border-radius: 999px;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.secondary-action:hover {
    background: var(--surface-soft);
    color: var(--text);
}

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

.footer-inner {
    padding: 2rem 0;
    color: var(--muted);
    font-size: 0.88rem;
    text-align: center;
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Loading overlay */

.loading-overlay {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(250, 249, 246, 0.9);
    backdrop-filter: blur(4px);
}

.loading-overlay.is-visible {
    display: flex;
}

.loading-panel {
    width: min(520px, 100%);
    padding: 2.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    text-align: center;
}

.loading-spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto 1.5rem;
    border: 3px solid #dbe2e4;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-title {
    margin-bottom: 0.75rem;
    font-family:
        Georgia,
        "Times New Roman",
        "Yu Mincho",
        serif;
    font-size: 1.4rem;
}

.loading-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */

@media (max-width: 991.98px) {
    .result-col {
        width: 50%;
    }

    .result-section {
        padding: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .hero {
        margin-bottom: 2.5rem;
    }

    .artwork-frame {
        padding: 1rem;
    }

    .result-col {
        width: 100%;
    }

    .result-section {
        padding: 1rem;
        border-radius: 18px;
    }

    .survey-panel {
        padding: 1.5rem;
    }
}

/* Language controls: compact and usable on narrow screens. */
.language-switch-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0.25rem 0.125rem;
  font: inherit;
  font-size: 0.875rem;
  opacity: 0.7;
  cursor: pointer;
}
.language-switch-button[aria-pressed="true"] {
  font-weight: 700;
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 0.25rem;
}
.language-switch-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Keep native numeric validation without visible increment/decrement buttons. */
.price-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}
.price-input[type="number"]::-webkit-inner-spin-button,
.price-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
