/* ===== Minimal reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }

/* ===== Base: metallic dark theme ===== */
:root {
    color-scheme: dark;
    --gold:          #C9A84C;
    --gold-bright:   #FFD700;
    --gold-dim:      #7A5C1E;
    --silver:        #BFC0C4;
    --bronze:        #B87333;
    --bg:            #080A0D;
    --surface:       #0E1014;
    --surface-2:     #141720;
    --border:        rgba(255,255,255,0.06);
    --border-gold:   rgba(201,168,76,0.35);
    --text:          #D8DDE6;
    --text-muted:    #5A5F6A;
    --text-dim:      #333740;
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    display: grid;
    grid-template-columns: 1fr min(640px, 100%) 1fr;
    grid-template-rows: auto 1fr;
}

/* ===== 上ペイン: 入力エリア ===== */
.input-pane {
    grid-column: 2;
    padding: 1.75rem 1.75rem 1.5rem;
    border-bottom: 1px solid;
    border-image: linear-gradient(90deg, transparent, rgba(201,168,76,0.25), transparent) 1;
}

.logo {
    height: 80px;
    width: auto;
    display: block;
    margin: 0 auto 1.5rem;
}

textarea {
    display: block;
    width: 100%;
    background: #1C2030;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: var(--text);
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    overflow: hidden;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 0.875rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}
textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.18), inset 0 1px 3px rgba(0,0,0,0.4);
}
textarea::placeholder { color: #4A5060; }

.form-actions {
    display: flex;
    justify-content: flex-end;
}

button[type="submit"] {
    display: inline-block;
    background: linear-gradient(180deg, #D4AA50 0%, #9A7520 100%);
    color: #08070A;
    border: none;
    border-radius: 6px;
    padding: 0.65rem 2.5rem;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 2px 10px rgba(201,168,76,0.25), inset 0 1px 0 rgba(255,255,255,0.15);
}
button[type="submit"]:not([disabled]):hover {
    background: linear-gradient(180deg, #FFD700 0%, #C9A84C 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(201,168,76,0.4);
}
button[type="submit"][disabled] { opacity: 0.25; cursor: not-allowed; }

.error-message {
    color: #FF6B6B;
    font-size: 0.8rem;
    margin: 0.75rem 0 0;
}

/* ===== 下ペイン: タイムライン ===== */
.timeline-pane {
    grid-column: 1 / -1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: none;
}

#timeline {
    max-width: 640px;
    margin: 0 auto;
    padding: 3rem 1.75rem 1rem;
}
.timeline-pane::-webkit-scrollbar { display: none; }

/* ===== 投稿カード ===== */
article.post-card {
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: none;
}

.post-content {
    word-break: break-all;
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0 0 0.625rem;
    color: var(--text);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-time {
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}

.post-score {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* ===== Score tier: 0 — No score (既存の0点投稿用) ===== */
article.tier-0 .post-content { color: var(--text-muted); }
article.tier-0 .post-score   { color: var(--text-dim); }

/* ===== Score tier: 1 (1–15) — Iron ===== */
article.tier-1 {
    border-color: rgba(130,138,155,0.18);
}
article.tier-1 .post-content { color: #7A8090; }
article.tier-1 .post-score   { color: #50555F; }

/* ===== Score tier: 2 (16–40) — Zinc ===== */
article.tier-2 {
    background: linear-gradient(160deg, #0E1018 0%, var(--surface) 100%);
    border-color: rgba(155,168,195,0.30);
    box-shadow: 0 0 10px rgba(155,168,195,0.07), 0 3px 12px rgba(0,0,0,0.3);
}
article.tier-2 .post-content { color: #9AAABB; }
article.tier-2 .post-score   { color: #6080A0; }
article.tier-2 .post-time    { color: #384050; }

/* ===== Score tier: 3 (41–99) — Bronze ===== */
article.tier-3 {
    background: linear-gradient(160deg, #1C1108 0%, #160C05 50%, var(--surface) 100%);
    border-color: rgba(184,115,51,0.5);
    box-shadow: 0 0 18px rgba(184,115,51,0.18),
                0 4px 16px rgba(0,0,0,0.4),
                inset 0 1px 0 rgba(184,115,51,0.1);
}
article.tier-3 .post-content { color: #D4A47A; }
article.tier-3 .post-score {
    color: var(--bronze);
    text-shadow: 0 0 8px rgba(184,115,51,0.6);
}
article.tier-3 .post-time { color: #5A4030; }

/* ===== Score tier: 4 (100–200) — Silver Rainbow ===== */
/* ボーダーが虹色で巡回しながら、カードが静かに浮遊し光の条が横切る */
@keyframes silverRainbow {
    0%   { box-shadow: 0 0 22px rgba(180,200,255,0.28), 0 4px 16px rgba(0,0,0,0.4); border-color: rgba(180,200,255,0.6); }
    25%  { box-shadow: 0 0 22px rgba(255,190,220,0.28), 0 4px 16px rgba(0,0,0,0.4); border-color: rgba(255,180,210,0.6); }
    50%  { box-shadow: 0 0 22px rgba(180,255,210,0.28), 0 4px 16px rgba(0,0,0,0.4); border-color: rgba(160,255,200,0.6); }
    75%  { box-shadow: 0 0 22px rgba(255,240,180,0.28), 0 4px 16px rgba(0,0,0,0.4); border-color: rgba(255,220,150,0.6); }
    100% { box-shadow: 0 0 22px rgba(180,200,255,0.28), 0 4px 16px rgba(0,0,0,0.4); border-color: rgba(180,200,255,0.6); }
}
@keyframes floatSubtle {
    0%, 100% { transform: translateY(0px); }
    50%      { transform: translateY(-3px); }
}
/* 光の条がカードをゆっくり横切る（overflow:hidden でクリップされる） */
@keyframes silverSweep {
    0%         { transform: translateX(-120%) skewX(-12deg); opacity: 0; }
    8%         { opacity: 0.9; }
    42%        { opacity: 0.9; }
    50%, 100%  { transform: translateX(280%) skewX(-12deg); opacity: 0; }
}

article.tier-4 {
    background: linear-gradient(160deg, #10101A 0%, #0D0C16 50%, var(--surface) 100%);
    border-color: rgba(180,200,255,0.6);
    animation: silverRainbow 5s ease-in-out infinite,
               floatSubtle 4s ease-in-out infinite;
}
article.tier-4::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 55%;
    background: linear-gradient(90deg, transparent, rgba(200,220,255,0.13), transparent);
    animation: silverSweep 7s ease-in-out infinite;
    pointer-events: none;
}
article.tier-4 .post-content {
    color: #C8D4F0;
    font-weight: 500;
}
article.tier-4 .post-score {
    color: #A0B8E8;
    text-shadow: 0 0 10px rgba(160,184,232,0.7), 0 0 20px rgba(160,184,232,0.3);
}
article.tier-4 .post-time { color: #405070; }

/* ===== Score tier: 5 (201–600) — Gold ===== */
/* ゴールドの光が脈打ちながら浮遊し、金色の条が通り抜ける */
@keyframes goldPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(201,168,76,0.20), 0 4px 20px rgba(0,0,0,0.5), inset 0 1px 0 rgba(201,168,76,0.12); }
    50%      { box-shadow: 0 0 45px rgba(201,168,76,0.45), 0 4px 20px rgba(0,0,0,0.5), inset 0 1px 0 rgba(201,168,76,0.22); }
}
@keyframes floatMid {
    0%, 100% { transform: translateY(0px); }
    50%      { transform: translateY(-4px); }
}
@keyframes goldSweep {
    0%         { transform: translateX(-120%) skewX(-14deg); opacity: 0; }
    8%         { opacity: 1; }
    42%        { opacity: 1; }
    50%, 100%  { transform: translateX(280%) skewX(-14deg); opacity: 0; }
}

article.tier-5 {
    background: linear-gradient(160deg, #221A08 0%, #161005 60%, var(--surface) 100%);
    border-color: rgba(201,168,76,0.55);
    animation: goldPulse 3s ease-in-out infinite,
               floatMid 3s ease-in-out infinite;
}
article.tier-5::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 55%;
    background: linear-gradient(90deg, transparent, rgba(255,215,100,0.16), transparent);
    animation: goldSweep 5s ease-in-out infinite;
    pointer-events: none;
}
article.tier-5 .post-content {
    color: #EED880;
    font-weight: 500;
}
article.tier-5 .post-score {
    color: var(--gold);
    text-shadow: 0 0 10px rgba(201,168,76,0.7), 0 0 22px rgba(201,168,76,0.35);
}
article.tier-5 .post-time { color: #6A5830; }

/* ===== Score tier: 6 (601–999) — Platinum ===== */
/* グローが激しく脈打ち、浮遊しながら走査線が上から下へ流れる */
@keyframes platinumPulse {
    0%, 100% {
        box-shadow: 0 0 25px rgba(255,215,0,0.28),
                    0 0 55px rgba(255,150,0,0.14),
                    0 6px 24px rgba(0,0,0,0.5),
                    inset 0 1px 0 rgba(255,215,0,0.2);
        border-color: rgba(255,215,0,0.65);
    }
    50% {
        box-shadow: 0 0 55px rgba(255,220,0,0.60),
                    0 0 100px rgba(255,140,0,0.32),
                    0 0 140px rgba(255,80,0,0.12),
                    0 6px 24px rgba(0,0,0,0.5),
                    inset 0 1px 0 rgba(255,215,0,0.3);
        border-color: rgba(255,225,0,0.95);
    }
}
@keyframes floatStrong {
    0%, 100% { transform: translateY(0px) scale(1.000); }
    50%      { transform: translateY(-6px) scale(1.005); }
}
/* 走査線がカード内を上→下へ流れる */
@keyframes scanLine {
    0%         { transform: translateY(-100%); opacity: 0; }
    5%         { opacity: 1; }
    95%        { opacity: 1; }
    100%       { transform: translateY(2000%); opacity: 0; }
}
@keyframes topLineGlow {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}

article.tier-6 {
    background: linear-gradient(160deg, #251E00 0%, #1A1200 50%, var(--surface) 100%);
    border-color: rgba(255,215,0,0.65);
    animation: platinumPulse 2s ease-in-out infinite,
               floatStrong 2.5s ease-in-out infinite;
}
/* 上端のゴールドライン（明滅） */
article.tier-6::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
    animation: topLineGlow 2s ease-in-out infinite;
}
/* 走査線 */
article.tier-6::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    top: 0;
    background: linear-gradient(90deg, transparent, rgba(255,230,0,0.55), transparent);
    animation: scanLine 3s ease-in-out infinite;
    pointer-events: none;
}
article.tier-6 .post-content {
    color: #FFE85A;
    font-weight: 600;
}
article.tier-6 .post-score {
    color: var(--gold-bright);
    text-shadow: 0 0 12px rgba(255,215,0,0.9), 0 0 30px rgba(255,180,0,0.55);
}
article.tier-6 .post-time { color: #7A6525; }

/* ===== Score tier: 7 (1000–1999) — Rainbow ===== */
/* 背景が流れ、浮遊しながら傾き、虹色のグローが巡回する */
@keyframes rainbowBg {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}
@keyframes rainbowBorder {
    0%   { box-shadow: 0 0 35px rgba(255,60,60,0.55),   0 0 75px rgba(255,60,60,0.22),   0 8px 28px rgba(0,0,0,0.6); border-color: rgba(255,110,110,0.95); }
    16%  { box-shadow: 0 0 35px rgba(255,165,0,0.55),   0 0 75px rgba(255,165,0,0.22),   0 8px 28px rgba(0,0,0,0.6); border-color: rgba(255,185,80,0.95); }
    33%  { box-shadow: 0 0 35px rgba(200,255,0,0.55),   0 0 75px rgba(200,255,0,0.22),   0 8px 28px rgba(0,0,0,0.6); border-color: rgba(220,255,80,0.95); }
    50%  { box-shadow: 0 0 35px rgba(0,255,120,0.55),   0 0 75px rgba(0,255,120,0.22),   0 8px 28px rgba(0,0,0,0.6); border-color: rgba(80,255,160,0.95); }
    66%  { box-shadow: 0 0 35px rgba(0,160,255,0.55),   0 0 75px rgba(0,160,255,0.22),   0 8px 28px rgba(0,0,0,0.6); border-color: rgba(80,185,255,0.95); }
    83%  { box-shadow: 0 0 35px rgba(180,0,255,0.55),   0 0 75px rgba(180,0,255,0.22),   0 8px 28px rgba(0,0,0,0.6); border-color: rgba(205,80,255,0.95); }
    100% { box-shadow: 0 0 35px rgba(255,60,60,0.55),   0 0 75px rgba(255,60,60,0.22),   0 8px 28px rgba(0,0,0,0.6); border-color: rgba(255,110,110,0.95); }
}
/* 浮遊しながらわずかに傾く */
@keyframes rainbowFloat {
    0%   { transform: translateY(0px)  rotate(0.0deg); }
    25%  { transform: translateY(-7px) rotate(0.4deg); }
    50%  { transform: translateY(0px)  rotate(0.0deg); }
    75%  { transform: translateY(-7px) rotate(-0.4deg); }
    100% { transform: translateY(0px)  rotate(0.0deg); }
}
@keyframes rainbowText {
    from { background-position: 0% center; }
    to   { background-position: 300% center; }
}
@keyframes rainbowScore {
    0%   { color: #ff9999; text-shadow: 0 0 14px rgba(255,60,60,1),   0 0 32px rgba(255,60,60,0.5); }
    16%  { color: #ffcc88; text-shadow: 0 0 14px rgba(255,165,0,1),   0 0 32px rgba(255,165,0,0.5); }
    33%  { color: #eeff88; text-shadow: 0 0 14px rgba(200,255,0,1),   0 0 32px rgba(200,255,0,0.5); }
    50%  { color: #88ffaa; text-shadow: 0 0 14px rgba(0,255,120,1),   0 0 32px rgba(0,255,120,0.5); }
    66%  { color: #88ccff; text-shadow: 0 0 14px rgba(0,160,255,1),   0 0 32px rgba(0,160,255,0.5); }
    83%  { color: #cc88ff; text-shadow: 0 0 14px rgba(180,0,255,1),   0 0 32px rgba(180,0,255,0.5); }
    100% { color: #ff9999; text-shadow: 0 0 14px rgba(255,60,60,1),   0 0 32px rgba(255,60,60,0.5); }
}

article.tier-7 {
    background: linear-gradient(135deg,
        #1A0505 0%, #050A1A 16%, #041008 33%,
        #0E0E04 50%, #04041A 66%, #100514 83%, #1A0505 100%);
    background-size: 300% 300%;
    border: 1px solid rgba(255,110,110,0.95);
    animation: rainbowBg 5s linear infinite,
               rainbowBorder 5s linear infinite,
               rainbowFloat 2s ease-in-out infinite;
}
article.tier-7 .post-content {
    background: linear-gradient(90deg,
        #ff8888 0%, #ffbb55 14%, #eeff55 28%,
        #55ff99 42%, #55bbff 57%, #bb55ff 71%, #ff55cc 85%, #ff8888 100%);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowText 3s linear infinite;
    font-weight: 700;
}
article.tier-7 .post-score {
    animation: rainbowScore 5s linear infinite;
}

/* ===== Score tier: 8 (2000+) — Legendary ===== */
/* 虹グローが猛烈に巡回し、カードが激しく揺れ、スケールも振動する */
@keyframes legendaryGlow {
    0%   { box-shadow: 0 0 45px rgba(255,60,60,0.85),   0 0 90px rgba(255,60,60,0.45),   0 0 140px rgba(255,60,60,0.18),   0 10px 40px rgba(0,0,0,0.7); border-color: rgba(255,120,120,1); }
    16%  { box-shadow: 0 0 45px rgba(255,165,0,0.85),   0 0 90px rgba(255,165,0,0.45),   0 0 140px rgba(255,165,0,0.18),   0 10px 40px rgba(0,0,0,0.7); border-color: rgba(255,190,80,1); }
    33%  { box-shadow: 0 0 45px rgba(200,255,0,0.85),   0 0 90px rgba(200,255,0,0.45),   0 0 140px rgba(200,255,0,0.18),   0 10px 40px rgba(0,0,0,0.7); border-color: rgba(220,255,80,1); }
    50%  { box-shadow: 0 0 45px rgba(0,255,120,0.85),   0 0 90px rgba(0,255,120,0.45),   0 0 140px rgba(0,255,120,0.18),   0 10px 40px rgba(0,0,0,0.7); border-color: rgba(80,255,155,1); }
    66%  { box-shadow: 0 0 45px rgba(0,150,255,0.85),   0 0 90px rgba(0,150,255,0.45),   0 0 140px rgba(0,150,255,0.18),   0 10px 40px rgba(0,0,0,0.7); border-color: rgba(80,170,255,1); }
    83%  { box-shadow: 0 0 45px rgba(180,0,255,0.85),   0 0 90px rgba(180,0,255,0.45),   0 0 140px rgba(180,0,255,0.18),   0 10px 40px rgba(0,0,0,0.7); border-color: rgba(200,80,255,1); }
    100% { box-shadow: 0 0 45px rgba(255,60,60,0.85),   0 0 90px rgba(255,60,60,0.45),   0 0 140px rgba(255,60,60,0.18),   0 10px 40px rgba(0,0,0,0.7); border-color: rgba(255,120,120,1); }
}
/* 縦横に激しく揺れながらスケールも振動する */
@keyframes legendaryShake {
    0%   { transform: translateX(0px)  translateY(0px)  rotate(0.0deg)  scale(1.000); }
    8%   { transform: translateX(-1px) translateY(-1px) rotate(-0.2deg) scale(1.004); }
    16%  { transform: translateX(2px)  translateY(1px)  rotate(0.3deg)  scale(0.997); }
    24%  { transform: translateX(-1px) translateY(2px)  rotate(-0.2deg) scale(1.006); }
    32%  { transform: translateX(2px)  translateY(-1px) rotate(0.2deg)  scale(0.994); }
    40%  { transform: translateX(-2px) translateY(1px)  rotate(-0.3deg) scale(1.004); }
    48%  { transform: translateX(1px)  translateY(-2px) rotate(0.3deg)  scale(1.000); }
    56%  { transform: translateX(-1px) translateY(-1px) rotate(-0.1deg) scale(1.004); }
    64%  { transform: translateX(2px)  translateY(1px)  rotate(0.2deg)  scale(0.997); }
    72%  { transform: translateX(-1px) translateY(0px)  rotate(-0.2deg) scale(1.003); }
    80%  { transform: translateX(1px)  translateY(2px)  rotate(0.2deg)  scale(0.997); }
    88%  { transform: translateX(-2px) translateY(-1px) rotate(-0.1deg) scale(1.004); }
    96%  { transform: translateX(1px)  translateY(0px)  rotate(0.1deg)  scale(1.000); }
    100% { transform: translateX(0px)  translateY(0px)  rotate(0.0deg)  scale(1.000); }
}
@keyframes legendaryScore {
    0%   { color: #fff; text-shadow: 0 0 20px rgba(255,60,60,1),   0 0 50px rgba(255,60,60,0.7),   0 0 100px rgba(255,60,60,0.4); }
    16%  { color: #fff; text-shadow: 0 0 20px rgba(255,165,0,1),   0 0 50px rgba(255,165,0,0.7),   0 0 100px rgba(255,165,0,0.4); }
    33%  { color: #fff; text-shadow: 0 0 20px rgba(200,255,0,1),   0 0 50px rgba(200,255,0,0.7),   0 0 100px rgba(200,255,0,0.4); }
    50%  { color: #fff; text-shadow: 0 0 20px rgba(0,255,120,1),   0 0 50px rgba(0,255,120,0.7),   0 0 100px rgba(0,255,120,0.4); }
    66%  { color: #fff; text-shadow: 0 0 20px rgba(0,150,255,1),   0 0 50px rgba(0,150,255,0.7),   0 0 100px rgba(0,150,255,0.4); }
    83%  { color: #fff; text-shadow: 0 0 20px rgba(180,0,255,1),   0 0 50px rgba(180,0,255,0.7),   0 0 100px rgba(180,0,255,0.4); }
    100% { color: #fff; text-shadow: 0 0 20px rgba(255,60,60,1),   0 0 50px rgba(255,60,60,0.7),   0 0 100px rgba(255,60,60,0.4); }
}

article.tier-8 {
    background: linear-gradient(135deg,
        #200808 0%, #080820 16%, #051808 33%,
        #181800 50%, #080820 66%, #180820 83%, #200808 100%);
    background-size: 300% 300%;
    border: 2px solid rgba(255,120,120,1);
    animation: rainbowBg 3s linear infinite,
               legendaryGlow 3s linear infinite,
               legendaryShake 1.4s ease-in-out infinite;
}
article.tier-8::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9px;
    background: linear-gradient(135deg,
        rgba(255,80,80,0.06) 0%, rgba(255,165,0,0.06) 16%,
        rgba(200,255,0,0.06) 33%, rgba(0,255,120,0.06) 50%,
        rgba(0,150,255,0.06) 66%, rgba(180,0,255,0.06) 83%,
        rgba(255,80,80,0.06) 100%);
    background-size: 300% 300%;
    animation: rainbowBg 3s linear infinite;
    pointer-events: none;
}
article.tier-8 .post-content {
    background: linear-gradient(90deg,
        #ff9999 0%, #ffcc77 12%, #ffff77 25%,
        #77ffbb 37%, #77ddff 50%, #cc77ff 62%, #ff77ee 75%, #ff9999 87%, #ffcc77 100%);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowText 2s linear infinite;
    font-weight: 800;
    font-size: 1.1rem;
}
article.tier-8 .post-score {
    animation: legendaryScore 3s linear infinite;
}
article.tier-8 .post-time { color: #604040; }

/* ===== ロードトリガー ===== */
.load-more-trigger {
    text-align: center;
    padding: 1.25rem;
    color: var(--text-dim);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
