/* News King - Dark Navy & Gold edition
   Full replacement stylesheet. Existing markup and functionality retained. */
/* ==================================================
   全体
================================================== */

body {
    margin: 0;
    padding: 0 15px 60px 15px;
    font-family: Arial, "Helvetica Neue", sans-serif;
    background: #f4f4f4;
    text-align: center;
    color: #222;
}


/* ==================================================
   見出し
================================================== */

h1 {
    margin: 30px 0 20px 0;
}

h2 {
    margin-top: 25px;
}

h3 {
    line-height: 1.5;
}


/* ==================================================
   リンク
================================================== */

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* ==================================================
   バトル
================================================== */

.battle {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 34px;
    margin: 35px auto 45px auto;
    width: 100%;
    box-sizing: border-box;
}


/* ==================================================
   ニュースカード
================================================== */

.news-card {
    background: white;
    width: 420px;
    min-height: 590px;
    padding: 22px;
    border-radius: 18px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.14);
    box-sizing: border-box;
    overflow: hidden;

    display: flex;
    flex-direction: column;
}

.news-card p,
.news-card h2,
.news-card h3,
.news-card form,
.news-card hr,
.news-card button,
.news-card div {
    flex-shrink: 0;
}

.news-card p,
.news-card h3 {
    overflow-wrap: anywhere;
}

.news-card h2 {
    margin-top: 18px;
    margin-bottom: 6px;
}

.news-card h3 {
    margin: 12px 0 18px 0;
    font-size: 20px;
}


/* ==================================================
   画像あり投稿
================================================== */

.news-image {
    order: -1;

    display: block;
    width: 100%;
    max-width: 100%;
    height: 360px;
    margin: 0 auto 8px auto;

    object-fit: contain;

    border-radius: 14px;
    box-sizing: border-box;
    background: #f0f0f0;
}


/* ==================================================
   画像なし投稿
   ニュース本文そのものをビジュアルとして大きく見せる
================================================== */

.news-card:not(:has(.news-image)) h3 {
    order: -1;

    min-height: 360px;
    margin: 0 0 8px 0;
    padding: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    border-radius: 14px;

    background:
        linear-gradient(
            145deg,
            #f7f7f7,
            #eeeeee
        );

    font-size: 30px;
    line-height: 1.45;
    font-weight: 800;

    overflow-wrap: anywhere;
}


/* ==================================================
   VS
================================================== */

.vs {
    align-self: center;

    font-size: 36px;
    font-weight: 900;

    padding: 0;

    flex-shrink: 0;
}


/* ==================================================
   投票ボタン・通常ボタン
================================================== */

button {
    padding: 11px 20px;

    border: none;
    border-radius: 10px;

    cursor: pointer;

    font-size: 15px;
    font-weight: bold;

    transition:
        transform 0.15s ease,
        opacity 0.15s ease;
}

button:hover:not(:disabled) {
    opacity: 0.88;
    transform: translateY(-1px);
}

button:disabled {
    cursor: default;
    opacity: 0.6;
}

.news-card form[action="/vote"] button {
    width: 100%;
    min-width: 0;

    padding: 14px 22px;

    font-size: 16px;

    border-radius: 12px;
}


/* ==================================================
   テキストエリア
================================================== */

textarea {
    font-family: inherit;
    font-size: 16px;

    padding: 12px;

    border: 1px solid #ccc;
    border-radius: 8px;

    box-sizing: border-box;
    max-width: 100%;
}


/* ==================================================
   ファイル選択
================================================== */

input[type="file"] {
    max-width: 100%;
    box-sizing: border-box;
}


/* ==================================================
   コメント
================================================== */

.comment-item {
    text-align: left;

    margin: 12px 0;
    padding: 10px;

    background: #f5f5f5;

    border-radius: 8px;

    overflow-wrap: anywhere;
}

.comment-item p {
    margin: 6px 0;
}

.comment-form {
    margin-top: 20px;
}

.comment-form textarea {
    width: 100%;
    resize: vertical;
}


/* ==================================================
   区切り線
================================================== */

hr {
    width: 100%;
    max-width: 900px;

    margin: 26px auto;

    border: 0;
    border-top: 1px solid #ddd;

    box-sizing: border-box;
}


/* ==================================================
   スマホ
================================================== */

@media screen and (max-width: 900px) {

    body {
        padding-left: 10px;
        padding-right: 10px;
    }

    .battle {
        flex-direction: column;
        align-items: center;
        gap: 22px;
        margin-top: 25px;
    }

    .news-card {
        width: 100%;
        max-width: 520px;
        min-height: 0;
        padding: 18px;
    }

    .vs {
        align-self: center;
        font-size: 30px;
    }

    .news-image {
        height: 420px;
    }

    .news-card:not(:has(.news-image)) h3 {
        min-height: 420px;
        padding: 30px;
        font-size: 30px;
    }

    textarea {
        width: 100%;
    }
}


/* ==================================================
   小さいスマホ
================================================== */

@media screen and (max-width: 520px) {

    body {
        padding-left: 8px;
        padding-right: 8px;
    }

    h1 {
        font-size: 28px;
    }

    h2 {
        font-size: 22px;
    }

    .news-card {
        padding: 12px;
        border-radius: 16px;
    }

    .news-card h2 {
        margin-top: 14px;
    }

    .news-card h3 {
        font-size: 19px;
        margin-bottom: 16px;
    }

    .news-image {
        width: calc(100% + 24px);
        max-width: none;

        height: 390px;

        margin-left: -12px;
        margin-right: -12px;
        margin-top: -12px;
        margin-bottom: 8px;

        border-radius: 16px 16px 0 0;
    }

    .news-card:not(:has(.news-image)) h3 {
        width: calc(100% + 24px);

        min-height: 210px;

        margin-left: -12px;
        margin-right: -12px;
        margin-top: -12px;
        margin-bottom: 8px;

        padding: 28px 22px;

        border-radius: 16px 16px 0 0;

        font-size: 28px;
        line-height: 1.45;
    }

    .vs {
        font-size: 28px;
    }

    button {
        max-width: 100%;
    }
}


/* ==================================================
   とても小さい画面
================================================== */

@media screen and (max-width: 380px) {

    .news-image {
        height: 330px;
    }

    .news-card:not(:has(.news-image)) h3 {
        min-height: 190px;
        font-size: 25px;
    }
}


/* ==================================================
   投稿画像：クリック拡大
================================================== */

.news-image {
    cursor: zoom-in;
}

.news-image:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

body.modal-open {
    overflow: hidden;
}

.image-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    box-sizing: border-box;

    background: rgba(0, 0, 0, 0.88);

    cursor: zoom-out;
}

.image-modal-image {
    display: block;

    max-width: min(94vw, 1400px);
    max-height: 90vh;

    width: auto;
    height: auto;

    object-fit: contain;

    border-radius: 12px;

    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);

    cursor: default;
}

.image-modal-close {
    position: fixed;

    top: 18px;
    right: 22px;

    width: 48px;
    height: 48px;

    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.92);

    color: #111;

    font-size: 34px;
    line-height: 1;

    cursor: pointer;

    z-index: 10000;
}

.image-modal-close:hover {
    opacity: 1;
    transform: scale(1.05);
}

@media screen and (max-width: 520px) {

    .image-modal-overlay {
        padding: 12px;
    }

    .image-modal-image {
        max-width: 96vw;
        max-height: 88vh;
        border-radius: 8px;
    }

    .image-modal-close {
        top: 12px;
        right: 12px;

        width: 44px;
        height: 44px;

        font-size: 30px;
    }
}
/* ==================================================
   ニュース王：公開向け軽量デザイン調整
   既存HTML・機能は変更しない
================================================== */

body {
    background: #f5f6f9;
    color: #1c2430;
}

h1 { margin: 22px 0 12px; letter-spacing: .025em; }
h2 { margin-top: 18px; }

.battle {
    gap: 24px;
    margin: 22px auto 28px;
    max-width: 1050px;
}

.news-card {
    width: min(420px, 100%);
    min-height: 0;
    padding: 18px;
    border: 1px solid #e7eaf0;
    border-radius: 18px;
    box-shadow: 0 6px 22px rgba(20, 32, 55, .08);
}

/* 王者（左）と挑戦者（右）を柔らかく色分け */
.battle > .news-card:first-child {
    border-top: 5px solid #d5a12a;
}
.battle > .news-card:last-child {
    border-top: 5px solid #e66558;
}

.news-card:not(:has(.news-image)) h3 {
    min-height: 200px;
    padding: 24px;
    font-size: clamp(22px, 2.3vw, 28px);
    background: linear-gradient(145deg, #f8f9fb, #eef1f5);
}

.news-image { height: 270px; }

.news-card h2 { margin-top: 12px; }
.news-card h3 { margin-bottom: 12px; }

.vs { font-size: 30px; color: #313b4b; }

.news-card form[action="/vote"] button:not(:disabled) {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 3px 10px rgba(37, 99, 235, .17);
}

.news-card form[action="/vote"] button:disabled {
    background: #edf0f4;
    color: #7a8290;
    opacity: 1;
    cursor: not-allowed;
}

button:focus-visible, a:focus-visible {
    outline: 3px solid #93b4ff;
    outline-offset: 2px;
}

@media screen and (max-width: 900px) {
    .battle { gap: 16px; margin-top: 20px; }
    .news-card { max-width: 520px; min-height: 0; }
    .news-image { height: 260px; }
    .news-card:not(:has(.news-image)) h3 {
        min-height: 180px;
        padding: 24px;
        font-size: 25px;
    }
}

@media screen and (max-width: 520px) {
    h1 { margin-top: 18px; }
    .news-card { padding: 12px; }
    .news-image { height: 250px; }
    .news-card:not(:has(.news-image)) h3 {
        min-height: 150px;
        padding: 22px 18px;
        font-size: 24px;
    }
    .vs { font-size: 25px; }
}

@media screen and (max-width: 380px) {
    .news-image { height: 220px; }
    .news-card:not(:has(.news-image)) h3 {
        min-height: 135px;
        font-size: 22px;
    }
}

/* ==================================================
   NEWS KING — DARK NAVY / GOLD THEME
   Additive overrides; safe for existing FastAPI templates
================================================== */
:root {
    color-scheme: dark;
    --nk-bg: #071326;
    --nk-bg-deep: #040b18;
    --nk-panel: #101f36;
    --nk-panel-soft: #182b45;
    --nk-text: #f3f6ff;
    --nk-muted: #b7c5d9;
    --nk-gold: #f2c76c;
    --nk-gold-deep: #bb852d;
    --nk-red: #ff6675;
    --nk-line: rgba(191,211,242,.20);
}
html { background: var(--nk-bg-deep); }
body {
    min-height: 100vh;
    color: var(--nk-text);
    background:
        radial-gradient(ellipse 38% 24% at 13% 30%, rgba(48,93,160,.22), transparent 95%),
        radial-gradient(ellipse 38% 24% at 87% 30%, rgba(151,44,75,.15), transparent 95%),
        radial-gradient(ellipse 55% 28% at 50% 4%, rgba(40,83,142,.26), transparent 95%),
        linear-gradient(155deg, #0c1b31 0%, #071326 45%, #040b18 100%);
    background-attachment: fixed;
    line-height: 1.55;
}
body > h1:first-of-type {
    color: var(--nk-gold);
    font-size: clamp(29px, 3vw, 40px);
    letter-spacing: .055em;
    text-shadow: 0 2px 20px rgba(242,199,108,.17);
}
h1, h2, h3, h4, strong { color: var(--nk-text); }
h2 { letter-spacing: .02em; }
p, label, small { color: inherit; }
a { color: #82b6ff; }
a:hover { color: #bad8ff; }
hr { border-top: 1px solid var(--nk-line); }
.battle {
    max-width: 1120px;
    gap: clamp(34px, 5.4vw, 76px);
    margin-top: 24px;
    margin-bottom: 30px;
    align-items: stretch;
}
.news-card {
    position: relative;
    width: min(430px, 100%);
    min-height: 0;
    padding: 18px;
    color: var(--nk-text);
    background: linear-gradient(160deg, rgba(25,45,72,.97), rgba(10,23,42,.99));
    border: 1px solid var(--nk-line);
    border-radius: 20px;
    box-shadow: 0 14px 40px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.04);
}
.battle > .news-card:first-child {
    border: 1px solid rgba(242,199,108,.70);
    border-top: 5px solid var(--nk-gold);
    box-shadow: 0 0 0 1px rgba(242,199,108,.08), 0 15px 40px rgba(0,0,0,.36), 0 0 32px rgba(242,199,108,.07);
}
.battle > .news-card:last-child {
    border: 1px solid rgba(255,102,117,.60);
    border-top: 5px solid var(--nk-red);
    box-shadow: 0 0 0 1px rgba(255,102,117,.06), 0 15px 40px rgba(0,0,0,.36), 0 0 32px rgba(255,102,117,.06);
}
.news-card h2, .news-card h3 { color: #fff; }
.news-card:not(:has(.news-image)) h3 {
    min-height: 180px;
    padding: 25px;
    color: #17243b;
    background: linear-gradient(145deg, #fffdf8 0%, #e5eaf3 100%);
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 13px;
    font-size: clamp(22px, 2.2vw, 28px);
    box-shadow: inset 0 1px 8px rgba(12,24,40,.045);
}
.news-image {
    height: 260px;
    background: #e6ebf3;
    border: 1px solid rgba(255,255,255,.14);
}
.vs {
    color: var(--nk-gold);
    font-size: clamp(34px, 4vw, 54px);
    font-weight: 900;
    text-shadow: 0 0 12px rgba(242,199,108,.38), 0 0 32px rgba(242,199,108,.20);
    letter-spacing: -.05em;
}
button {
    color: var(--nk-text);
    background: #233650;
    border: 1px solid rgba(207,223,247,.15);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
button:hover:not(:disabled) { opacity: 1; filter: brightness(1.13); }
button:disabled {
    background: rgba(174,191,218,.09);
    color: #a7b4c7;
    border-color: rgba(207,223,247,.08);
    opacity: .85;
}
.news-card form[action="/vote"] button:not(:disabled) {
    background: linear-gradient(120deg, #f7d98f, #dba94d);
    color: #152238;
    border: 1px solid #f9dda1;
    box-shadow: 0 5px 18px rgba(220,167,64,.18);
}
.battle > .news-card:last-child form[action="/vote"] button:not(:disabled) {
    background: linear-gradient(120deg, #ff8591, #e14f64);
    color: #fff;
    border-color: #ff9aa5;
    box-shadow: 0 5px 18px rgba(225,79,100,.16);
}
.news-card form[action="/vote"] button:disabled {
    background: rgba(174,191,218,.08);
    color: #9faec3;
    border-color: rgba(207,223,247,.07);
    opacity: 1;
}
.comment-item {
    background: rgba(255,255,255,.065);
    border: 1px solid rgba(255,255,255,.08);
    color: var(--nk-text);
}
textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select {
    background: #15263f;
    color: #f7f9ff;
    border: 1px solid rgba(196,215,244,.30);
    border-radius: 9px;
}
textarea::placeholder, input::placeholder { color: #a9b8cd; }
textarea:focus, input:focus, select:focus { outline: 2px solid rgba(242,199,108,.65); outline-offset: 1px; }
input[type="file"] { color: var(--nk-muted); }
input[type="file"]::file-selector-button {
    color: #17243b;
    background: #e6c47d;
    border: 0;
    border-radius: 8px;
    padding: 9px 12px;
    margin-right: 10px;
    cursor: pointer;
}
button:focus-visible, a:focus-visible { outline: 3px solid var(--nk-gold); outline-offset: 3px; }
/* Readable native dialogs and image viewer */
.image-modal-overlay { background: rgba(1,5,12,.94); }
.image-modal-close { background: #f0d08c; color: #17243b; }
/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    button { transition: none; }
}
@media screen and (max-width: 900px) {
    .battle { gap: 15px; }
    .news-card { max-width: 520px; }
    .vs { font-size: 38px; }
    .news-image { height: 245px; }
    .news-card:not(:has(.news-image)) h3 { min-height: 160px; }
}
@media screen and (max-width: 520px) {
    body { padding-left: 8px; padding-right: 8px; }
    .news-card { padding: 12px; }
    .news-card:not(:has(.news-image)) h3 {
        min-height: 145px;
        padding: 20px 16px;
        font-size: 23px;
    }
    .news-image { height: 235px; }
    .vs { font-size: 32px; }
}

/* Navigation and queue redesign */
.nk-header { display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap; padding:14px max(18px, calc((100vw - 1240px)/2)); margin:0 -15px; background:rgba(4,14,31,.96); border-bottom:1px solid rgba(242,199,108,.28); box-shadow:0 6px 28px rgba(0,0,0,.2); text-align:left; }
.nk-brand { color:#f2c76c; font-weight:900; font-size:24px; white-space:nowrap; }
.nk-brand:hover { color:#ffe4a9; text-decoration:none; }
.nk-nav,.nk-account { display:flex; align-items:center; gap:15px; }
.nk-account form { margin:0; }
.nk-account button { padding:9px 13px; font-size:13px; }
.nk-nav a:not(.nk-post),.nk-account>a { color:#e1eafa; font-weight:700; }
.nk-post { padding:10px 17px; border-radius:10px; background:linear-gradient(135deg,#ffe3a0,#dca94d); color:#15243a; font-weight:800; white-space:nowrap; box-shadow:0 4px 16px rgba(220,169,77,.18); }
.nk-post:hover { color:#15243a; text-decoration:none; filter:brightness(1.08); }
.nk-main { max-width:1200px; margin:0 auto; }
.nk-hero { padding-top:15px; }
.nk-hero h1 { margin:10px 0 4px; color:#f2c76c; }
.nk-hero p { margin:3px 0 17px; color:#c5d1e5; font-size:14px; }
.nk-queue { max-width:900px; margin:18px auto 35px; padding:23px 16px 28px; border:1px solid rgba(242,199,108,.27); border-radius:17px; background:linear-gradient(130deg,rgba(28,49,80,.95),rgba(9,23,44,.95)); box-shadow:0 10px 35px rgba(0,0,0,.15); }
.nk-queue h2 { color:#f2c76c; margin-top:0; }
.nk-queue a[href="/post"] { display:inline-block; padding:10px 18px; border:1px solid #e8bc63; border-radius:9px; color:#f5d28a; font-weight:700; }
.nk-queue a[href="/post"]:hover { background:rgba(242,199,108,.12); text-decoration:none; }
@media(max-width:900px) { .nk-header { margin:0 -10px; padding:12px 14px; } .nk-nav { order:3; width:100%; justify-content:center; } .nk-account { margin-left:auto; } }
@media(max-width:520px) { .nk-header { margin:0 -8px; gap:9px; } .nk-brand { font-size:19px; } .nk-account { gap:8px; font-size:12px; } .nk-account button { padding:8px; font-size:12px; } .nk-nav { font-size:13px; } .nk-post { padding:9px 12px; } .nk-hero h1 { font-size:27px; } .nk-queue { padding:20px 12px; } }
