/* ============================================
   ShogiBoardQ - GitHub Pages Stylesheet
   Color scheme derived from the app's UI:
   golden shogi board, blue table headers,
   orange player panels, warm gray chrome
   ============================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* App-derived palette */
    --color-board: #d4b060;
    --color-board-frame: #a09860;
    --color-board-light: #f0d888;
    --color-koma-bg: #fce7b1;
    --color-blue: #4a90d9;
    --color-blue-dark: #3578c0;
    --color-blue-deeper: #2a5f9e;
    --color-blue-light: #e8f0fa;
    --color-orange: #f0a020;
    --color-orange-light: #fdf0d0;

    /* Page colors */
    --color-bg: #f5f3ef;
    --color-bg-alt: #eae6de;
    --color-text: #333333;
    --color-text-muted: #6b6560;
    --color-heading: #2a2520;
    --color-border: #d4c8a8;
    --color-card-bg: #ffffff;
    --color-card-shadow: rgba(160, 152, 96, 0.12);
    --color-hero-bg: var(--color-blue);
    --color-hero-text: #ffffff;
    --color-code-bg: #f0ebe3;
    --color-footer-bg: #2a5580;
    --color-footer-text: #c0d8f0;

    --font-main: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    --font-heading: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "MS Mincho", serif;
    --max-width: 1100px;
    --section-padding: 5rem 1.5rem;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-blue-dark);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

img {
    max-width: 100%;
    height: auto;
}

/* --- Navigation --- */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(42, 95, 158, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(74, 144, 217, 0.4);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-logo {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--color-hero-text);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.nav-logo:hover {
    color: #fff;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: #fff;
    text-decoration: none;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-hero-text);
    margin: 5px 0;
    transition: all 0.3s ease;
}

/* --- Hero --- */
.hero {
    background:
        linear-gradient(135deg, #3578c0 0%, #4a90d9 40%, #5a9ee0 70%, #4a90d9 100%);
    color: var(--color-hero-text);
    padding: 8rem 1.5rem 5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(255, 255, 255, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: var(--max-width);
    margin: 0 auto;
}

.hero-piece-decoration {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    opacity: 0.55;
}

.hero-piece-decoration img {
    width: 40px;
    height: 40px;
    filter: brightness(1.4) saturate(0.6);
}

.hero-icon {
    width: 128px;
    height: 128px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 2.5rem;
    font-weight: 300;
}

.hero-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.03em;
}

/* --- Share Button (nav) --- */
.share-btn-x {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.share-btn-x:hover {
    background: #fff;
    color: #000;
    text-decoration: none;
}

/* --- Section Common --- */
.section {
    padding: var(--section-padding);
}

.section-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--color-heading);
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: 0.03em;
}

.section-title::after {
    content: "";
    display: block;
    width: 40px;
    height: 3px;
    background: var(--color-board);
    margin: 0.75rem auto 0;
    border-radius: 2px;
}

.section-desc {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 3rem;
    font-size: 0.95rem;
}

.section--alt {
    background-color: var(--color-bg-alt);
}

/* --- Screenshot Section --- */
.screenshot-gallery {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    max-width: 960px;
    margin: 0 auto;
}

.screenshot-item {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 16px var(--color-card-shadow);
}

.screenshot-item img {
    display: block;
    width: 100%;
    height: auto;
}

.screenshot-caption {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
}

/* --- Features --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.feature-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 2rem 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.feature-card:hover {
    box-shadow: 0 6px 24px var(--color-card-shadow);
    transform: translateY(-2px);
}

.feature-icon {
    width: 45px;
    height: 45px;
    margin-bottom: 1rem;
    opacity: 0.85;
}

.feature-card h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--color-heading);
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.7;
}

/* --- Build Section --- */
.build-content {
    max-width: 700px;
    margin: 0 auto;
}

.build-requirements {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.req-item {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.25rem 1rem;
    text-align: center;
}

.req-item strong {
    display: block;
    font-family: var(--font-heading);
    color: var(--color-heading);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.req-item span {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.build-steps {
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.5rem;
}

.build-steps h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--color-heading);
    margin-bottom: 1rem;
}

.build-steps pre {
    background: #1e2d3d;
    color: #d8e8f4;
    padding: 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

.build-steps code {
    font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", monospace;
}

/* --- Download / Links --- */
.download-section {
    text-align: center;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-blue);
    color: #fff;
    padding: 0.9rem 2.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background 0.2s ease, transform 0.2s ease;
    margin-bottom: 1rem;
}

.download-btn:hover {
    background: var(--color-blue-dark);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.download-note {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* --- License Section --- */
.license-content {
    max-width: 700px;
    margin: 0 auto;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 2rem;
}

.license-content p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--color-text);
}

.license-points {
    list-style: none;
    margin: 1.25rem 0;
    padding: 0;
}

.license-points li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.7;
}

.license-points li::before {
    content: "\2022";
    position: absolute;
    left: 0.25rem;
    color: var(--color-board);
    font-weight: bold;
}

.license-link {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* --- Footer --- */
.site-footer {
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 2.5rem 1.5rem;
    text-align: center;
    font-size: 0.85rem;
}

.site-footer a {
    color: #a0d0ff;
}

.site-footer a:hover {
    color: #fff;
}

/* --- Responsive --- */

/* Tablet */
@media (max-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --section-padding: 3rem 1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: rgba(42, 95, 158, 0.98);
        flex-direction: column;
        padding: 1rem 1.5rem;
        gap: 0.75rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .hero {
        padding: 5.5rem 1rem 3rem;
    }

    .hero-icon {
        width: 96px;
        height: 96px;
        border-radius: 16px;
        margin-bottom: 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .hero-piece-decoration {
        gap: 0.4rem;
        margin-bottom: 1.5rem;
    }

    .hero-piece-decoration img {
        width: 28px;
        height: 28px;
    }

    .hero-badges {
        gap: 0.5rem;
    }

    .badge {
        padding: 0.25rem 0.6rem;
        font-size: 0.75rem;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .section-desc {
        margin-bottom: 2rem;
        font-size: 0.9rem;
    }

    .screenshot-gallery {
        gap: 1.5rem;
    }

    .screenshot-caption {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .feature-card {
        padding: 1.5rem 1.25rem;
    }

    .build-requirements {
        grid-template-columns: 1fr;
    }

    .build-steps {
        padding: 1rem;
    }

    .build-steps pre {
        padding: 1rem;
        font-size: 0.8rem;
    }

    .download-btn {
        padding: 0.75rem 2rem;
        font-size: 0.9rem;
    }

    .hero--sub {
        padding: 4.5rem 1rem 2rem;
    }

    .hero--sub h1 {
        font-size: 1.8rem;
    }

    .guide-step-title {
        font-size: 1.05rem;
    }

    .guide-step-text {
        font-size: 0.9rem;
    }
}

/* --- Sub-page Hero --- */
.hero--sub {
    padding: 5rem 1.5rem 2.5rem;
}

.hero--sub h1 {
    font-size: 2.2rem;
    margin-bottom: 0.75rem;
}

/* --- Guide Steps --- */
.guide-step {
    margin-bottom: 3rem;
}

.guide-step:last-child {
    margin-bottom: 0;
}

.guide-step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.guide-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-blue);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.guide-step-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--color-heading);
}

.guide-step-text {
    color: var(--color-text);
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.guide-step-text ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}

.guide-step-text ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.4rem;
}

.guide-step-text ul li::before {
    content: "\2022";
    position: absolute;
    left: 0.25rem;
    color: var(--color-board);
    font-weight: bold;
}

/* --- Feature Card Link --- */
a.feature-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

a.feature-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.feature-card-more {
    display: block;
    margin-top: auto;
    padding-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--color-blue);
    font-weight: 500;
}

a.feature-card-link:hover .feature-card-more {
    color: var(--color-blue-dark);
}

/* --- Judgment Table --- */
.judgment-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 16px var(--color-card-shadow);
    max-width: 700px;
    margin: 0 auto;
}

.judgment-table th {
    background: var(--color-blue);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    text-align: left;
    letter-spacing: 0.03em;
}

.judgment-table td {
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
}

.judgment-table tr:last-child td {
    border-bottom: none;
}

.judgment-table tbody tr:nth-child(even) {
    background: var(--color-bg);
}

.judgment-table .judgment-label {
    font-weight: 600;
    color: var(--color-heading);
}

.judgment-note {
    max-width: 700px;
    margin: 1.5rem auto 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1.8;
}

.judgment-note ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}

.judgment-note ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.4rem;
}

.judgment-note ul li::before {
    content: "\2022";
    position: absolute;
    left: 0.25rem;
    color: var(--color-board);
    font-weight: bold;
}

@media (max-width: 480px) {
    .judgment-table th,
    .judgment-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* --- Info Table (generic reusable table) --- */
.info-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 16px var(--color-card-shadow);
    margin: 1rem 0;
}

.info-table th {
    background: var(--color-blue);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    text-align: left;
    letter-spacing: 0.03em;
}

.info-table td {
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
}

.info-table tr:last-child td {
    border-bottom: none;
}

.info-table tbody tr:nth-child(even) {
    background: var(--color-bg);
}

/* --- Format Examples --- */
.format-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.format-example {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--color-card-shadow);
}

.format-example h4 {
    background: var(--color-blue);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    margin: 0;
    letter-spacing: 0.03em;
}

.format-example pre {
    margin: 0;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    line-height: 1.6;
    overflow-x: auto;
    background: var(--color-bg);
}

.format-example code {
    font-family: "Cascadia Code", "Fira Code", "Source Code Pro", monospace;
    color: var(--color-text);
}

/* --- Export Image Frame --- */
.screenshot-item--export img {
    width: calc(100% - 4rem);
    margin: 2rem auto 1.5rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

/* --- Back Link --- */
.back-link-section {
    text-align: center;
    padding: 2rem 1.5rem 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    color: var(--color-blue-dark);
    font-weight: 500;
}

.back-link:hover {
    color: var(--color-blue);
}

/* Small phone */
@media (max-width: 480px) {
    :root {
        --section-padding: 2.5rem 0.75rem;
    }

    .nav-inner {
        padding: 0 1rem;
    }

    .hero {
        padding: 5rem 0.75rem 2.5rem;
    }

    .hero-icon {
        width: 80px;
        height: 80px;
        border-radius: 14px;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .hero-piece-decoration {
        gap: 0.25rem;
    }

    .hero-piece-decoration img {
        width: 22px;
        height: 22px;
    }

    .hero-badges {
        gap: 0.4rem;
    }

    .badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .feature-card {
        padding: 1.25rem 1rem;
    }

    .feature-icon {
        width: 36px;
        height: 36px;
    }

    .feature-card h3 {
        font-size: 1rem;
    }

    .feature-card p {
        font-size: 0.85rem;
    }

    .build-content {
        max-width: 100%;
    }

    .build-steps pre {
        font-size: 0.75rem;
        padding: 0.75rem;
    }

    .site-footer {
        padding: 1.5rem 1rem;
    }

    .hero--sub {
        padding: 4rem 0.75rem 1.5rem;
    }

    .hero--sub h1 {
        font-size: 1.5rem;
    }

    .guide-step-number {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .guide-step-title {
        font-size: 1rem;
    }

    .info-table th,
    .info-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .format-examples {
        grid-template-columns: 1fr;
    }

    .format-example pre {
        font-size: 0.72rem;
    }
}
