/* Takase — Phase 1 styles */

:root {
    --color-text: #2c2c2c;
    --color-bg: #fff;
    --color-bg-warm: #f8f7f5;
    --color-accent: #800000;
    --color-link: #2c5282;
    --color-muted: #666;
    --color-border: #eee;
    --font-serif: Georgia, 'Times New Roman', Times, serif;
    --font-heading: 'Exo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    color: #1a1a1a;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-warm) url('/static/images/bg_body-repeat.jpg') repeat;
}

/* Header */
header {
    background: var(--color-bg-warm) url('/static/images/bg-header-japanese-paper.jpg') center / cover no-repeat;
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--color-accent);
}
.header-inner {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
}
.logo {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    text-decoration: none;
}
.logo img {
    height: 50px;
    width: auto;
}
.header-catchphrase {
    flex: 1;
    text-align: center;
}
.catchphrase-main {
    font-family: 'Times New Roman', Times, var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1.2;
}
.catchphrase-sub {
    font-size: 1rem;
    color: var(--color-text);
    margin-top: 0.15rem;
}

/* Site navigation bar */
.site-nav {
    background: #1a1a1a;
    text-align: center;
    padding: 0.6rem 2rem;
}
.site-nav a {
    color: #fff;
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    margin: 0 1rem;
}
.site-nav a:hover {
    color: #ccc;
}

/* Global headings */
h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--color-accent);
}

/* Main */
main {
    flex: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
    width: 100%;
    min-height: 800px;
    background: url('/static/images/bg_body.jpg') center top no-repeat;
}

/* Hero / Index */
.hero {
    text-align: center;
    padding: 1rem 0 4rem;
}
.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}
.hero p {
    color: var(--color-text);
    margin-bottom: 2rem;
    text-align: left;
    line-height: 1.65;
}
.name-form {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    max-width: 500px;
    margin: 0 auto;
}
.name-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
    border: 2px solid #ddd;
    border-radius: 6px;
}
.name-form input:focus {
    outline: none;
    border-color: #1a1a1a;
}
.name-form button {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    background: linear-gradient(to bottom, #333, #1a1a1a);
    color: #fff;
    border: 1px solid #111;
    border-bottom: 3px solid #000;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06),
                inset 0 1px 0 rgba(255,255,255,0.15);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.name-form button:hover {
    background: linear-gradient(to bottom, #444, #222);
    box-shadow: 0 3px 6px rgba(0,0,0,0.22), 0 6px 12px rgba(0,0,0,0.08),
                inset 0 1px 0 rgba(255,255,255,0.2);
    transform: translateY(-1px);
}
.name-form button:active {
    background: linear-gradient(to bottom, #111, #000);
    transform: translateY(2px);
    border-bottom-width: 1px;
    box-shadow: 0 0 2px rgba(0,0,0,0.12), inset 0 2px 4px rgba(0,0,0,0.15);
}

/* Name page */
.name-page {
    text-align: center;
    padding: 2rem 0;
}
.name-page h1 {
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
}
.name-page > p {
    color: #666;
    margin-bottom: 2rem;
}

.designs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}
.design-card {
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.design-label {
    color: #fff;
    font-size: 1.125rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.purchase-section {
    margin-top: 2rem;
}
.price {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.buy-button {
    padding: 1rem 3rem;
    font-size: 1.25rem;
    background: linear-gradient(to bottom, #a03030, #800000);
    color: #fff;
    border: 1px solid #600;
    border-bottom: 3px solid #400;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06),
                inset 0 1px 0 rgba(255,255,255,0.2);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.buy-button:hover {
    background: linear-gradient(to bottom, #b03838, #901010);
    border-color: #700;
    border-bottom-color: #500;
    box-shadow: 0 3px 6px rgba(0,0,0,0.22), 0 6px 12px rgba(0,0,0,0.08),
                inset 0 1px 0 rgba(255,255,255,0.25);
    transform: translateY(-1px);
}
.buy-button:active {
    background: linear-gradient(to bottom, #700000, #600000);
    transform: translateY(2px);
    border-bottom-width: 1px;
    box-shadow: 0 0 2px rgba(0,0,0,0.12), inset 0 2px 4px rgba(0,0,0,0.15);
}
.buy-button:disabled {
    background: #999;
    border-color: #888;
    border-bottom: 3px solid #777;
    cursor: wait;
    box-shadow: none;
    transform: none;
}
.buy-button-loading {
    background: linear-gradient(to bottom, #700000, #600000);
    border-color: #400;
    border-bottom-color: #300;
    cursor: wait;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.08);
}
.design-card .buy-button {
    padding: 0.4rem 1.25rem;
    font-size: 0.85rem;
    border-radius: 4px;
    margin-top: auto;
    border-bottom-width: 2px;
}

/* Success page */
.success-page {
    text-align: center;
    padding: 3rem 0;
}
.success-page h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #34A853;
}
.downloads {
    margin: 2rem auto;
    max-width: 400px;
}
.downloads h2 {
    margin-bottom: 1rem;
}
.download-link {
    display: block;
    padding: 1rem;
    margin: 0.5rem 0;
    background: linear-gradient(to bottom, #333, #1a1a1a);
    color: #fff;
    text-decoration: none;
    border: 1px solid #111;
    border-bottom: 3px solid #000;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06),
                inset 0 1px 0 rgba(255,255,255,0.15);
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.download-link:hover {
    background: linear-gradient(to bottom, #444, #222);
    color: #fff;
    box-shadow: 0 3px 6px rgba(0,0,0,0.22), 0 6px 12px rgba(0,0,0,0.08),
                inset 0 1px 0 rgba(255,255,255,0.2);
    transform: translateY(-1px);
}
.download-note {
    margin-top: 1rem;
    color: #999;
    font-size: 0.875rem;
}

/* Error page */
.error-page {
    text-align: center;
    padding: 3rem 0;
}
.error-page h1 {
    color: #EA4335;
}

/* Design showcase grid (Section 2) */
.showcase-grid {
    display: flex;
    justify-content: center;
    gap: 1rem;
}
.showcase-grid figure {
    text-align: center;
}
.showcase-grid img {
    width: 150px;
    height: 150px;
    border-radius: 4px;
}
.showcase-grid figcaption {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--color-muted);
}

/* Landing page sections */
.landing-section {
    padding: 2.5rem 0;
    border-top: 1px solid #eee;
}
.landing-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.landing-section p {
    margin-bottom: 1rem;
    color: #333;
}
.landing-section p:last-child {
    margin-bottom: 0;
}

/* Design styles list (Section 4) */
.design-styles {
    margin-top: 1rem;
}
.design-styles dt {
    font-weight: 600;
    margin-top: 1rem;
}
.design-styles dd {
    margin-left: 0;
    margin-top: 0.25rem;
    color: #333;
}

/* About section (Section 7) */
.about-section {
    text-align: center;
}
.about-section blockquote {
    font-style: italic;
    margin: 1.5rem 0;
    color: #444;
}
.about-section blockquote cite {
    display: block;
    font-style: normal;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}
.about-section a {
    color: #1a1a1a;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Article typography & layout                                               */
/* ═══════════════════════════════════════════════════════════════════════════ */

article {
    font-family: var(--font-serif);
    font-size: 18px;
    line-height: 1.75;
    color: var(--color-text);
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 0 2rem;
}

/* Headings */
article h1 {
    font-size: 2.25rem;
    font-weight: 500;
    line-height: 1.25;
    margin-bottom: 1rem;
}
article h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
}
article h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

/* Body text */
article p {
    margin-bottom: 1.25rem;
}

/* Links */
article a {
    color: var(--color-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
article a:hover {
    color: var(--color-accent);
}

/* Blockquotes */
article blockquote {
    border-left: 3px solid var(--color-accent);
    padding: 0.5rem 0 0.5rem 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #444;
}
article blockquote p {
    margin-bottom: 0.5rem;
}
article blockquote p:last-child {
    margin-bottom: 0;
}

/* Lists */
article ul, article ol {
    margin: 1rem 0 1.25rem 1.5rem;
}
article li {
    margin-bottom: 0.5rem;
}

/* Tables */
article table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.5;
}
article th, article td {
    border: 1px solid #ccc;
    padding: 0.5rem 0.75rem;
    text-align: left;
}
article th {
    background: #f5f4f2;
    font-weight: 600;
    font-size: 0.85rem;
    color: #444;
}
article tr:nth-child(even) {
    background: #fafaf8;
}

/* Horizontal rules */
article hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2.5rem 0;
}

/* Images — default centered block */
article img {
    display: block;
    margin: 2em auto;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Float classes for attr_list usage */
article .float-left {
    float: left;
    max-width: 45%;
    margin: 0.5em 1.5em 1em 0;
}
article .float-right {
    float: right;
    max-width: 45%;
    margin: 0.5em 0 1em 1.5em;
}

/* Captions: em-only paragraph adjacent to an image paragraph */
article p:has(> img) + p:has(> em:only-child) {
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-muted);
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}
article p:has(> em:only-child):has(+ p > img) {
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

/* Bold interview questions */
article p > strong:first-child:last-child {
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Content index (Library, Blog)                                             */
/* ═══════════════════════════════════════════════════════════════════════════ */

.content-index {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 0 2rem;
}
.content-index h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 2rem;
}
.article-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.article-entry {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-border);
}
.article-entry:first-child {
    padding-top: 0;
}
.article-entry:last-child {
    border-bottom: none;
}
.article-entry h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    line-height: 1.35;
}
.article-entry h2 a {
    color: var(--color-text);
    text-decoration: none;
}
.article-entry h2 a:hover {
    color: var(--color-link);
}
.article-date {
    font-size: 0.875rem;
    color: var(--color-muted);
}
.article-desc {
    margin-top: 0.5rem;
    color: #444;
    line-height: 1.6;
}

/* Library index — flowing text layout */
.library-intro {
    margin-bottom: 2rem;
    color: #444;
    line-height: 1.7;
}
.library-category {
    margin-bottom: 2rem;
}
.library-category h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.library-entry {
    margin-bottom: 1rem;
    line-height: 1.7;
}
.library-entry a {
    color: var(--color-link);
    text-decoration: none;
}
.library-entry a:hover {
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Results page                                                              */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* Results hero */
.results-hero {
    text-align: center;
    padding: 2rem 0 1rem;
}
.results-hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
}
.attribution {
    color: #666;
    font-size: 0.95rem;
}

/* Term links (glossary hover + link) */
.term-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted #999;
    cursor: help;
}
.term-link:hover {
    border-bottom-color: var(--color-link);
    color: var(--color-link);
}

/* Pronunciation hover tooltip */
.pron-tooltip-wrap {
    position: relative;
    display: inline-block;
}
.pron-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #eee;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 10;
    font-size: 0.875rem;
    font-weight: normal;
    line-height: 1.7;
    text-align: left;
}
.pron-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1a1a1a;
}
.pron-tooltip-wrap:hover .pron-tooltip {
    display: block;
}
.pron-option:hover .pron-tooltip {
    display: block;
}
.pron-tooltip-line {
    display: block;
}
.pron-tooltip-line strong {
    color: #fff;
}

/* Translation frame */
.translation-frame {
    text-align: center;
    padding: 0.5rem 0 1.5rem;
    font-size: 1.1rem;
}
.variant-hint {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: #666;
}
.variant-hint a { color: #1a1a1a; }

/* Famous people */
.famous-people {
    padding: 0;
    color: #333;
    line-height: 1.7;
}
.famous-people p { margin-bottom: 0; }
.famous-people a { color: #1a1a1a; }

/* Design cards — StockKanji-style framed cards */
.design-cards-section {
    padding: 0 0 1.5rem;
}
.designs-showcase {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 1.5rem;
}
.design-card {
    border: 1px solid #999;
    text-align: center;
    width: 185px;
    display: flex;
    flex-direction: column;
    aspect-ratio: auto;
    align-items: stretch;
    justify-content: flex-start;
    border-radius: 0;
}
.design-card-image {
    background: var(--color-bg-warm) url('/static/images/bg-header-japanese-paper.jpg') center / cover no-repeat;
    padding: 1rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.design-card-image img {
    max-width: 100%;
    height: auto;
}
.design-card-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 0.5rem;
    border-top: 1px solid #ccc;
    flex: 1;
}
.design-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1a1a;
}
.design-desc {
    font-size: 0.8rem;
    color: var(--color-muted);
    line-height: 1.4;
}
.design-price {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 0.15rem;
}
.generation-error {
    text-align: center;
    color: #666;
    padding: 2rem;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Verify section */
.verify-section {
    padding: 2rem 0;
    border-top: 1px solid #eee;
}
.verify-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}
.verify-box {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1rem 0;
    position: relative;
}
.verify-box p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    padding-right: 4rem;
}
.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    background: linear-gradient(to bottom, #333, #1a1a1a);
    color: #fff;
    border: 1px solid #111;
    border-bottom: 2px solid #000;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.12);
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.copy-btn:hover {
    background: linear-gradient(to bottom, #444, #222);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateY(-1px);
}
.share-note {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: #999;
}
.share-note a { color: #666; }

/* Search again */
.search-again {
    text-align: center;
    padding: 1.5rem 0;
}
.search-again-link {
    color: #1a1a1a;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid #ddd;
    padding-bottom: 2px;
}
.search-again-link:hover { border-color: #1a1a1a; }

/* Layer divider */
.layer-divider {
    border: none;
    border-top: 2px solid #eee;
    margin: 1rem 0 0;
}
.layer2-header {
    text-align: center;
    padding: 2rem 0 1rem;
}
.layer2-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.layer2-header p {
    color: #666;
    font-size: 0.95rem;
}

/* Name introduction (Kaggle) */
.name-intro {
    padding: 0 0 1.5rem;
    color: #333;
}

/* Etymology section */
.etymology-section {
    padding: 1rem 0 1.5rem;
    border-top: 1px solid #eee;
}
.etymology-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}
.etymology-section p {
    margin-bottom: 0.75rem;
    color: #333;
}

/* Pronunciations section */
.pronunciations-section {
    padding: 1.5rem 0;
    border-top: 1px solid #eee;
}
.pronunciations-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}
.lang-group-header {
    font-size: 1rem;
    font-weight: 600;
    margin: 1rem 0 0.25rem;
    color: #444;
}
.pronunciation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.pronunciation-table tr { border-bottom: 1px solid #f0f0f0; }
.pronunciation-table td { padding: 0.4rem 0.5rem; }
.pron-col { color: #555; white-space: nowrap; }
.arrow-col { color: #ccc; text-align: center; width: 2rem; }
.romaji-col { font-weight: 500; }
.romaji-col a { color: #1a1a1a; text-decoration: underline; }
.badge-col { text-align: right; }
.badge {
    display: inline-block;
    font-size: 0.75rem;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}
.current-variant { background: #f8f8f8; }

/* Pronunciation overflow toggle (CSS-only) */
.toggle-input { display: none; }
.toggle-content { display: none; }
.toggle-input:checked ~ .toggle-content { display: block; }
.toggle-input:checked ~ .toggle-label { display: none; }
.toggle-label {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    color: #1a1a1a;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}
.toggle-label:hover { background: #f5f5f5; }

/* Create My Name CTA */
.create-cta {
    padding: 2rem 0;
    border-top: 1px solid #eee;
    text-align: center;
}
.create-cta h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.create-cta p {
    color: #555;
    margin-bottom: 1rem;
}
.cta-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    background: linear-gradient(to bottom, #333, #1a1a1a);
    color: #fff;
    text-decoration: none;
    border: 1px solid #111;
    border-bottom: 3px solid #000;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06),
                inset 0 1px 0 rgba(255,255,255,0.15);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.cta-button:hover {
    background: linear-gradient(to bottom, #444, #222);
    color: #fff;
    box-shadow: 0 3px 6px rgba(0,0,0,0.22), 0 6px 12px rgba(0,0,0,0.08),
                inset 0 1px 0 rgba(255,255,255,0.2);
    transform: translateY(-1px);
}
.cta-button:active {
    background: linear-gradient(to bottom, #111, #000);
    transform: translateY(2px);
    border-bottom-width: 1px;
    box-shadow: 0 0 2px rgba(0,0,0,0.12), inset 0 2px 4px rgba(0,0,0,0.15);
}

/* Archetype E: Create My Name primary */
.create-primary {
    text-align: center;
    padding: 2rem 0;
}
.create-primary p {
    margin-bottom: 1rem;
    color: #333;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Pronunciation Builder                                                     */
/* ═══════════════════════════════════════════════════════════════════════════ */

.builder-section {
    text-align: center;
    padding: 1.5rem 0;
}
.builder-heading {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}
.builder-heading-pronunciation {
    font-size: 1.35rem;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}
.builder-subtext {
    color: #555;
    margin-bottom: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Sound grid */
.sound-grid {
    max-width: 600px;
    margin: 0 auto 1rem;
    text-align: left;
}
.sound-grid-label {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    margin: 0.75rem 0 0.35rem;
    text-transform: uppercase;
}
.sound-grid-tier {
    font-size: 0.65rem;
    color: #999;
    margin: 0.5rem 0 0.2rem;
}
.sound-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.sound-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 0.45rem 0.5rem 0.3rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
    border: 1px solid rgba(0,0,0,0.18);
    border-bottom: 2px solid rgba(0,0,0,0.25);
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.7);
    transition: background 0.12s, border-color 0.12s, transform 0.08s;
    line-height: 1.1;
}
.sound-btn:hover {
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(255,255,255,0.3));
    border-color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-1px);
}
.sound-btn:active {
    transform: translateY(1px);
    border-bottom-width: 1px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}
.sound-btn-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.sound-btn-hint {
    font-size: 0.65rem;
    font-weight: 400;
    color: #999;
    margin-top: 1px;
}
.sound-btn-hint b {
    font-weight: 700;
    color: #555;
}
.sound-btn-vowel {
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1)), rgba(180, 140, 100, 0.08);
}
.sound-btn-vowel:hover {
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(255,255,255,0.3)), rgba(180, 140, 100, 0.08);
}
.sound-btn-separator {
    border-style: dashed;
    color: #999;
    min-width: 48px;
}
.sound-btn-separator .sound-btn-hint {
    color: #bbb;
}
.sound-btn-separator:hover {
    color: var(--color-accent);
}
.sound-btn-separator[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Sound strip (chips) */
.sound-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.6rem 0.75rem;
    margin: 0 auto 1rem;
    max-width: 600px;
    background: #f8f7f5;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.sound-strip-empty {
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
}
.sound-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.sound-chip-stressed {
    font-weight: 700;
    color: var(--color-accent);
    border-color: var(--color-accent);
}
.sound-chip-separator {
    padding: 0.25rem 0.25rem;
    min-width: 0;
    font-size: 0.8rem;
    color: #999;
    background: transparent;
    border: 1px dashed #ccc;
}
.sound-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.85rem;
    line-height: 1;
    color: #999;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
}
.sound-chip-remove:hover {
    color: #c00;
    background: #fee;
}
.sound-strip-clear {
    font-size: 0.75rem;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 0.25rem;
}
.sound-strip-clear:hover {
    color: var(--color-accent);
}

/* Builder actions (Done / Start Over) */
.builder-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    flex-wrap: wrap;
}
.builder-done-btn {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    background: linear-gradient(to bottom, #a03030, #800000);
    color: #fff;
    border: 1px solid #600;
    border-bottom: 3px solid #400;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06),
                inset 0 1px 0 rgba(255,255,255,0.2);
    transition: background 0.15s, transform 0.1s;
}
.builder-done-btn:hover {
    background: linear-gradient(to bottom, #b03838, #901010);
    transform: translateY(-1px);
}
.builder-done-btn:active {
    background: linear-gradient(to bottom, #700000, #600000);
    transform: translateY(2px);
    border-bottom-width: 1px;
}
.builder-done-btn:disabled {
    background: #bbb;
    border-color: #999;
    border-bottom: 3px solid #888;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.builder-back-btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    color: var(--color-text);
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
    border: 1px solid rgba(0,0,0,0.22);
    border-bottom: 2px solid rgba(0,0,0,0.30);
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.7);
    transition: background 0.12s, transform 0.08s;
}
.builder-back-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-1px);
}

/* Kana reveal */
.kana-reveal {
    text-align: center;
    margin: 1.5rem 0;
}
.kana-reveal-box {
    display: inline-block;
    padding: 1.5rem 2.5rem;
    background: #f8f7f5;
    border: 2px solid var(--color-accent);
    border-radius: 8px;
}
.kana-reveal-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: 0.1em;
}
.kana-reveal-romaji {
    font-size: 1rem;
    color: var(--color-muted);
    margin-top: 0.25rem;
    font-style: italic;
}
.kana-reveal-pronunciation {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-top: 0.15rem;
}

/* Builder preview card (calligraphy in Refine view) */
.builder-preview-wrapper {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}
.builder-preview-card {
    width: 185px;
}
.builder-preview-card .design-card-image {
    position: relative;
    min-height: 180px;
}
.builder-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}
.builder-preview-overlay::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid #999;
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: builder-spin 0.8s linear infinite;
}
.builder-preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    color: var(--color-muted);
}
.builder-preview-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid #ddd;
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: builder-spin 0.8s linear infinite;
}
@keyframes builder-spin {
    to { transform: rotate(360deg); }
}
.builder-buy-btn {
    margin-top: 0.25rem;
}

/* Question cards (stress + ambiguity) */
.question-card {
    max-width: 500px;
    margin: 1rem auto;
    text-align: left;
}
.question-text {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}
.question-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.question-opt {
    flex: 1;
    min-width: 100px;
    padding: 0.6rem 0.75rem;
    text-align: center;
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
    border: 1px solid rgba(0,0,0,0.22);
    border-bottom: 3px solid rgba(0,0,0,0.30);
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.7);
    transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.question-opt:hover {
    border-color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-1px);
}
.question-opt.selected {
    background: linear-gradient(to bottom, #900, var(--color-accent));
    color: #fff;
    border-color: #500;
    border-bottom: 3px solid #300;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.question-opt-label {
    font-weight: 600;
    font-size: 0.9rem;
}
.question-opt-kana {
    font-size: 0.8rem;
    margin-top: 0.15rem;
    opacity: 0.8;
}

/* BTN variant picker */
.btn-variant-picker {
    max-width: 500px;
    margin: 0.75rem auto;
    text-align: left;
}
.btn-variant-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.35rem;
}
.btn-variant-option {
    display: block;
    font-size: 0.85rem;
    padding: 0.2rem 0;
    cursor: pointer;
    color: #333;
}
.btn-variant-option input[type="radio"] {
    margin-right: 0.3rem;
}
.btn-variant-lang {
    font-weight: 600;
}
.btn-variant-pron {
    font-family: monospace;
}

/* Educational notes */
.builder-note {
    max-width: 500px;
    margin: 0.75rem auto;
    padding: 0.6rem 0.9rem;
    background: #f0f4f8;
    border-left: 3px solid #4a90d9;
    border-radius: 0 4px 4px 0;
    font-size: 0.85rem;
    color: #444;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.builder-note-text {
    flex: 1;
    line-height: 1.5;
}
.builder-note-dismiss {
    background: none;
    border: none;
    font-size: 1rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.builder-note-dismiss:hover {
    color: #666;
}

/* Language selector (inline in name-info-bar) */
.builder-language-select {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid rgba(0,0,0,0.22);
    border-radius: 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
}

/* Try again link */
.builder-try-again {
    text-align: center;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}
.builder-try-again a {
    color: var(--color-link);
}

/* Builder entry point ("I say it differently" / "How do you pronounce") */
.builder-entry {
    text-align: center;
    margin-top: 0.75rem;
}
.builder-entry-link {
    color: var(--color-link);
    font-size: 0.9rem;
    text-decoration: none;
    border-bottom: 1px dotted var(--color-link);
}
.builder-entry-link:hover {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* Hidden inline builder (shown when user clicks entry point) */
.builder-inline-hidden {
    display: none;
}

/* Overflow collapse label (inside expanded toggle-content) */
.pron-overflow {
    text-align: center;
}
.pron-overflow-collapse {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    color: #1a1a1a;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}
.pron-overflow-collapse:hover {
    background: #f5f5f5;
}

/* Builder loading state */
.builder-loading {
    text-align: center;
    padding: 2rem;
    color: var(--color-muted);
}

/* Mode selector (segmented button group) */
.mode-selector {
    display: flex;
    max-width: 500px;
    margin: 0 auto 1rem;
    border: 1px solid rgba(0,0,0,0.22);
    border-radius: 6px;
    overflow: hidden;
}
.mode-btn {
    flex: 1;
    padding: 0.5rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    color: var(--color-text);
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
    border: none;
    border-right: 1px solid rgba(0,0,0,0.15);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.mode-btn:last-child {
    border-right: none;
}
.mode-btn:hover {
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(255,255,255,0.3));
    color: var(--color-accent);
}
.mode-btn-active {
    background: linear-gradient(to bottom, #900, var(--color-accent));
    color: #fff;
}
.mode-btn-active:hover {
    background: linear-gradient(to bottom, #900, var(--color-accent));
    color: #fff;
}
.mode-btn-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Text input panel (Type Pronunciation / Type Romaji) */
.text-input-panel {
    max-width: 500px;
    margin: 0 auto 1rem;
    text-align: left;
}
.text-input-instruction {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.5rem;
}
.text-input-field {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
}
.text-input-field:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(128,0,0,0.12);
}
.text-input-hint {
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.35rem;
}
.text-input-error {
    font-size: 0.85rem;
    color: #c00;
    margin-top: 0.5rem;
    line-height: 1.5;
}
.text-input-error a {
    color: var(--color-link);
}
.text-input-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
    background: linear-gradient(to bottom, #a03030, #800000);
    color: #fff;
    border: 1px solid #600;
    border-bottom: 3px solid #400;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.text-input-submit:hover {
    background: linear-gradient(to bottom, #b03838, #901010);
    transform: translateY(-1px);
}
.text-input-submit:disabled {
    background: #bbb;
    border-color: #999;
    border-bottom: 3px solid #888;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 640px) {
    .mode-selector {
        flex-direction: column;
    }
    .mode-btn {
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.15);
    }
    .mode-btn:last-child {
        border-bottom: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Hero Showcase (4-card preview grid)                                       */
/* ═══════════════════════════════════════════════════════════════════════════ */

.hero-showcase {
    text-align: center;
    padding: 0.5rem 0 1rem;
}
.hero-showcase h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}
.hero-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 700px;
    margin: 0 auto;
}
.hero-card {
    text-decoration: none;
    color: inherit;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.hero-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.hero-card-image {
    background: var(--color-bg-warm) url('/static/images/bg-header-japanese-paper.jpg') center / cover no-repeat;
    padding: 1rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-card-image img {
    max-width: 100%;
    height: auto;
}
.hero-card-label {
    display: block;
    padding: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
    border-top: 1px solid #ddd;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Section intro text + Kana section                                         */
/* ═══════════════════════════════════════════════════════════════════════════ */

.section-intro {
    color: #444;
    margin-bottom: 1.25rem;
    line-height: 1.65;
}
.kana-section {
    padding: 1.5rem 0;
    border-top: 1px solid #eee;
}
.kana-section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Pronunciation selector (inline horizontal)                                */
/* ═══════════════════════════════════════════════════════════════════════════ */

.pronunciation-selector {
    margin: 1rem 0;
}
.pron-explanation {
    text-align: left;
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
}
.pron-buttons-bar {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.35rem 1.5rem;
    overflow: visible;
}
.pron-option {
    display: inline-block;
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.4rem 0.85rem;
    border: 1px solid rgba(0,0,0,0.22);
    border-bottom: 3px solid rgba(0,0,0,0.30);
    border-radius: 6px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    cursor: pointer;
}
.pron-option:hover {
    background: linear-gradient(to bottom, rgba(255,255,255,0.7), rgba(255,255,255,0.25));
    border-color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    color: var(--color-accent);
    box-shadow: 0 3px 6px rgba(0,0,0,0.22), 0 6px 12px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.9);
    transform: translateY(-1px);
}
.pron-option:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
    box-shadow: 0 0 2px rgba(0,0,0,0.12), inset 0 2px 4px rgba(0,0,0,0.15);
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), rgba(255,255,255,0.3));
}
.pron-option-active {
    background: linear-gradient(to bottom, #900, var(--color-accent));
    color: #fff;
    border-color: #500;
    border-bottom: 3px solid #300;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.pron-option-active:hover {
    background: linear-gradient(to bottom, #900, var(--color-accent));
    color: #fff;
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Name info bar (gender buttons + Kaggle rank)                              */
/* ═══════════════════════════════════════════════════════════════════════════ */

.name-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.2rem 0;
    gap: 0.3rem;
}
.name-info-left {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}
.gender-buttons-bar {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}
.info-bar-search {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.gender-option {
    display: inline-block;
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.15rem 0.5rem;
    border: 1px solid rgba(0,0,0,0.22);
    border-bottom: 2px solid rgba(0,0,0,0.30);
    border-radius: 4px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    cursor: pointer;
}
.gender-option:hover {
    background: linear-gradient(to bottom, rgba(255,255,255,0.7), rgba(255,255,255,0.25));
    border-color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    color: var(--color-accent);
    box-shadow: 0 3px 6px rgba(0,0,0,0.22), 0 6px 12px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.9);
    transform: translateY(-1px);
}
.gender-option:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
    box-shadow: 0 0 2px rgba(0,0,0,0.12), inset 0 2px 4px rgba(0,0,0,0.15);
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), rgba(255,255,255,0.3));
}
.gender-option-active {
    background: linear-gradient(to bottom, #900, var(--color-accent));
    color: #fff;
    border-color: #500;
    border-bottom: 2px solid #300;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.gender-option-active:hover {
    background: linear-gradient(to bottom, #900, var(--color-accent));
    color: #fff;
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.info-bar-input {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid rgba(0,0,0,0.22);
    border-radius: 4px;
    width: 10rem;
    outline: none;
}
.info-bar-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(153,0,0,0.15);
}
.kaggle-rank {
    font-size: 0.85rem;
    color: var(--color-muted);
}
.ref-links {
    display: inline-flex;
    gap: 0.2rem;
    margin-left: 0.3rem;
}
.ref-link {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
    transition: opacity 0.2s, color 0.2s, border-color 0.2s;
}
.ref-link-disabled {
    color: #aaa;
    background: #f0f0f0;
    border-color: #ddd;
    pointer-events: none;
    opacity: 0.5;
}
.ref-link-active {
    color: var(--color-link);
    background: #fff;
    border-color: var(--color-link);
    pointer-events: auto;
    opacity: 1;
    cursor: pointer;
}
.ref-link-active:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Meaning selector (kanji meaning switching — same visual pattern as pron)  */
/* ═══════════════════════════════════════════════════════════════════════════ */

.meaning-selector {
    text-align: center;
    margin-bottom: 1.2rem;
}
.meaning-buttons-bar {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.35rem 1.5rem;
}
.meaning-option {
    display: inline-block;
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.4rem 0.85rem;
    border: 1px solid rgba(0,0,0,0.22);
    border-bottom: 3px solid rgba(0,0,0,0.30);
    border-radius: 6px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    cursor: pointer;
}
.meaning-option:hover {
    background: linear-gradient(to bottom, rgba(255,255,255,0.7), rgba(255,255,255,0.25));
    border-color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    color: var(--color-accent);
    box-shadow: 0 3px 6px rgba(0,0,0,0.22), 0 6px 12px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.9);
    transform: translateY(-1px);
}
.meaning-option:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
    box-shadow: 0 0 2px rgba(0,0,0,0.12), inset 0 2px 4px rgba(0,0,0,0.15);
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), rgba(255,255,255,0.3));
}
.meaning-option-active {
    background: linear-gradient(to bottom, #900, var(--color-accent));
    color: #fff;
    border-color: #500;
    border-bottom: 3px solid #300;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.meaning-option-active:hover {
    background: linear-gradient(to bottom, #900, var(--color-accent));
    color: #fff;
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.meaning-selector-note {
    font-size: 0.85rem;
    color: #666;
    margin: 0.3rem 0 0;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Specialty section (phrase compositions)                                    */
/* ═══════════════════════════════════════════════════════════════════════════ */

.specialty-section {
    padding: 1.5rem 0;
    border-top: 1px solid #eee;
}
.specialty-section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}
.specialty-showcase {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}
.specialty-6 {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
}
.specialty-6 .design-card {
    width: auto;
    min-width: 0;
}
.specialty-4 .design-card {
    width: 185px;
}

/* Word/kanji design cards — same 6-across grid as specialty-6 */
.word-showcase {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
}
.word-showcase .design-card {
    width: auto;
    min-width: 0;
}

/* Unified 4-line card labels: name / pronunciation / kana / description */
.card-label-4line {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    line-height: 1.3;
    gap: 0;
}
.card-name {
    font-weight: 700;
    margin: 0;
}
.card-pron {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--color-muted);
    margin: 0;
}
.card-kana {
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--color-muted);
    margin: 0;
}
.card-romaji {
    font-weight: 400;
    font-size: 0.78rem;
    font-style: italic;
    color: #999;
    margin: 0;
}
.card-desc {
    font-weight: 400;
    font-size: 0.8rem;
    color: #444;
    margin-top: 0.4rem;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Meaning section                                                           */
/* ═══════════════════════════════════════════════════════════════════════════ */

.meaning-section {
    padding: 1.5rem 0;
    border-top: 1px solid #eee;
}
.meaning-section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}
.meaning-section h3 {
    font-size: 1.15rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}
.meaning-section p {
    margin-bottom: 0.75rem;
    color: #333;
    line-height: 1.65;
}
.meaning-teaching {
    font-style: italic;
    color: #555;
}

/* Complete picture — 3-beat summary */
.complete-picture {
    background: #f8f7f5;
    border-left: 3px solid var(--color-accent);
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
    border-radius: 0 4px 4px 0;
}
.complete-picture p {
    margin-bottom: 0.4rem;
    color: #333;
}
.complete-picture p:last-child {
    margin-bottom: 0;
    font-weight: 600;
}

/* Alternative kanji options */
.alt-kanji {
    margin: 1rem 0;
}
.alt-kanji-heading {
    font-weight: 600;
    color: #444;
    margin-bottom: 0.5rem;
}
.alt-kanji ul {
    margin: 0.5rem 0 0 1.5rem;
}
.alt-kanji li {
    margin-bottom: 0.35rem;
    color: #333;
}

/* Related designs — 4-column meaning cards, centered to match kana/hero width */
.related-showcase {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 0.75rem auto 0;
    max-width: 812px;
}
.related-showcase .design-card {
    width: auto;
    min-width: 0;
}

/* Mobile-first adjustments */
@media (max-width: 640px) {
    .name-info-bar {
        flex-direction: column;
        align-items: center;
        gap: 0.4rem;
    }
    .hero {
        padding: 2rem 0;
    }
    .hero h1 {
        font-size: 1.75rem;
    }
    .name-form {
        flex-direction: column;
    }
    .name-form button {
        width: 100%;
    }
    .results-hero h1 {
        font-size: 2rem;
    }
    .showcase-grid {
        flex-wrap: wrap;
    }
    .showcase-grid figure {
        flex: none;
    }
    .designs-showcase {
        flex-wrap: wrap;
        gap: 1rem;
    }
    .design-card {
        width: 45%;
    }
    .verify-box p {
        padding-right: 0;
    }
    .copy-btn {
        position: static;
        display: block;
        margin-top: 0.75rem;
        width: 100%;
    }
    .pronunciation-table {
        font-size: 0.85rem;
    }
    /* Header */
    .header-inner {
        text-align: center;
    }
    .logo {
        position: static;
        transform: none;
        display: inline-flex;
        margin-bottom: 0.5rem;
    }
    .catchphrase-main {
        font-size: 1.4rem;
    }
    .catchphrase-sub {
        font-size: 0.85rem;
    }
    .site-nav a {
        margin: 0 0.5rem;
    }
    /* Hero grid → 2×2 */
    .hero-showcase h1 {
        font-size: 2rem;
    }
    .hero-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    /* Specialty cards → 2 per row on mobile */
    .specialty-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    .specialty-4 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .specialty-4 .design-card {
        width: auto;
    }
    /* Meaning cards → 3 per row on mobile (already works, keep as is) */
    .word-showcase {
        grid-template-columns: repeat(3, 1fr);
    }
    /* Related designs → 2×2 */
    .related-showcase {
        grid-template-columns: repeat(2, 1fr);
    }
    /* Builder */
    .builder-heading {
        font-size: 1.4rem;
    }
    .sound-btn {
        min-width: 42px;
        padding: 0.4rem 0.35rem 0.25rem;
        font-size: 0.85rem;
    }
    .sound-btn-hint {
        font-size: 0.6rem;
    }
    .kana-reveal-large {
        font-size: 2rem;
    }
    .kana-reveal-box {
        padding: 1rem 1.5rem;
    }
    .question-options {
        flex-direction: column;
    }
    .question-opt {
        min-width: auto;
    }
    /* Article */
    article {
        font-size: 16px;
    }
    article h1 {
        font-size: 1.75rem;
    }
    article h2 {
        font-size: 1.25rem;
    }
    article .float-left,
    article .float-right {
        float: none;
        max-width: 100%;
        margin: 2em auto;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--color-muted);
    font-size: 0.875rem;
    border-top: 2px solid var(--color-accent);
    background: var(--color-bg-warm) url('/static/images/bg-header-japanese-paper.jpg') center / cover no-repeat;
}
footer p {
    margin-bottom: 0.35rem;
}
footer p:last-child {
    margin-bottom: 0;
}
.footer-links a {
    color: #888;
    text-decoration: none;
}
.footer-links a:hover {
    color: var(--color-text);
}
