/* =========================================================================
   OTOCO Front Web
   Flutter版Webのデザイン（lib/const/app_colors.dart, app_text_style.dart）を再現
   ========================================================================= */

:root {
    --main: #FFFFFF;
    --text: #202020;
    --text2: #333333;
    --black: #020202;
    --black1: #212121;
    --aqua: #1AC2DE;
    --light-blue: #BECAD8;
    --ios-blue: #006EE6;
    --light-gray: #CCCCCC;
    --light-gray2: #F4F4F4;
    --gray: #999999;
    --gray2: #A4A4A4;
    --dark-gray: #666666;
    --dark-gray2: #727272;
    --border: #FAFAFA;
    --border2: #EEEEEE;
    --white1: #F9F9F9;
    --red: #DF2C32;
    --red2: #E72F27;
    --pink: #F18E9C;
    --green2: #59B530;
    --orange: #F49527;

    --side-ad: 200px;
    --side-menu: 80px;
    --appbar-h: 56px;
    --bottom-nav-h: 60px;
    --font: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--main);
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.link { color: var(--ios-blue); font-weight: 700; word-break: break-all; }
.link-underline { color: var(--aqua); text-decoration: underline; }

/* ---- SVGアイコン（mask で色を変更） ---- */
.icon {
    display: inline-block;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}
.icon-10 { width: 10px; height: 10px; }
.icon-11 { width: 11px; height: 11px; }
.icon-12 { width: 12px; height: 12px; }
.icon-14 { width: 14px; height: 14px; }
.icon-16 { width: 16px; height: 16px; }
.icon-18 { width: 18px; height: 18px; }
.icon-20 { width: 20px; height: 20px; }
.icon-24 { width: 24px; height: 24px; }
.icon-32 { width: 32px; height: 32px; }
.img-icon { flex-shrink: 0; display: inline-block; }

/* =========================================================================
   レイアウト
   ========================================================================= */
.shell {
    display: flex;
    min-height: 100vh;
}
.ad-col {
    width: var(--side-ad);
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--border2);
}
.ad-right { border-right: 0; border-left: 1px solid var(--border2); }
.ad-unit { position: sticky; top: 0; min-height: 200px; }

.side-menu {
    width: var(--side-menu);
    flex-shrink: 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    border-right: 1px solid var(--border2);
    position: sticky;
    top: 0;
    height: 100vh;
}
.side-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 24px;
    color: var(--light-gray);
    width: 100%;
    max-width: 200px;
    transition: background .15s;
}
.side-menu-item:hover { background: var(--light-gray2); }
.side-menu-item.is-active { color: var(--text); }
.side-menu-label { display: none; font-size: 14px; font-weight: 400; color: var(--gray2); white-space: nowrap; }
.side-menu-item.is-active .side-menu-label { color: var(--text); font-weight: 700; }

.center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid var(--border2);
}
.page-body { flex: 1; position: relative; overflow-x: clip; }

@media (min-width: 1251px) {
    :root { --side-menu: 232px; }
    .side-menu-label { display: inline; }
}
/* 768〜1023pxは中央カラムが狭くなりすぎるため広告カラムを非表示 */
@media (max-width: 1023px) {
    .ad-col { display: none; }
}

.bottom-nav { display: none; }
@media (max-width: 768px) {
    .side-menu { display: none; }
    .center { border-right: 0; padding-bottom: var(--bottom-nav-h); }
    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        height: var(--bottom-nav-h);
        background: #fff;
        border-top: 1px solid var(--border2);
        z-index: 50;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: var(--gray2);
        font-size: 10px;
        transform: scale(.9);
    }
    .bottom-nav-item.is-active { color: var(--text); font-weight: 700; font-size: 10.2px; transform: none; }
}

/* 下部固定バー（コメント入力欄など） */
.bottom-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 30;
    border-top: 1px solid var(--border2);
}
@media (max-width: 768px) {
    .center:has(.bottom-bar) { padding-bottom: 0; }
}

/* プレーン画面（ログイン等） */
.plain-page { min-height: 100vh; display: flex; flex-direction: column; }
.plain-body { flex: 1; display: flex; justify-content: center; }

/* =========================================================================
   アプリバー
   ========================================================================= */
.appbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.appbar-main {
    height: var(--appbar-h);
    display: flex;
    align-items: center;
    padding: 0 8px;
}
.appbar-side { flex: 1 1 0; display: flex; align-items: center; min-width: 0; }
.appbar-right { justify-content: flex-end; }
.appbar-title {
    flex: 0 1 auto;
    max-width: 70%;
    text-align: center;
    animation: fadeIn .5s ease;
}
.appbar-title-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark-gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}
.appbar-logo img { display: block; width: 89px; height: 26px; animation: logoIn .5s ease; }
.appbar-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    color: var(--dark-gray);
    border-radius: 50%;
}
.appbar-back:hover { background: var(--light-gray2); }
.appbar-subtitle {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
}
.appbar-subtitle h1 { font-size: 16px; font-weight: 500; color: var(--black); }
.appbar-action {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    font-size: 8px;
    color: var(--text2);
    border-radius: 6px;
    background: none;
    border: 0;
}
.appbar-action:hover { background: var(--light-gray2); }
.appbar-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 0; background: none; border-radius: 50%; color: var(--dark-gray);
}
.appbar-icon-btn:hover { background: var(--light-gray2); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes logoIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }

/* =========================================================================
   ボタン・フォーム
   ========================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 56px;
    min-width: 248px;
    padding: 0 24px;
    border: 0;
    border-radius: 2px;
    background: var(--aqua);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 0 2px 2px rgba(238, 238, 238, .4);
    transition: opacity .15s;
}
.btn:hover { opacity: .9; }
.btn:disabled, .btn.is-disabled { opacity: .4; cursor: not-allowed; }
.btn-gray { background: var(--gray); }
.btn-block { width: 100%; min-width: 0; }
.btn-sm { min-height: 40px; min-width: 0; font-size: 14px; padding: 0 16px; }
.btn-pill { border-radius: 20px; min-height: 32px; min-width: 0; padding: 0 20px; font-size: 14px; box-shadow: none; }
.btn-light { background: var(--border2); color: #000; box-shadow: none; }
.btn-text { background: none; border: 0; color: var(--text); box-shadow: none; text-decoration: underline; font-size: 16px; font-weight: 500; }

.form { width: 100%; }
.field { margin-bottom: 28px; }
.field-label { display: block; font-size: 12px; font-weight: 700; color: var(--dark-gray); margin-bottom: 6px; }
.field-title { display: block; font-size: 16px; font-weight: 500; color: var(--black); margin-bottom: 8px; }
.input, .select, .textarea {
    width: 100%;
    font: inherit;
    font-size: 14px;
    color: var(--text);
    padding: 8px 12px;
    min-height: 44px;
    border: 1px solid var(--light-gray);
    border-radius: 2px;
    background: #fff;
    outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--aqua); }
.input::placeholder, .textarea::placeholder { color: var(--gray2); font-weight: 400; }
.input-filled { border: 0; border-radius: 8px; background: var(--white1); }
.input-filled2 { border: 0; border-radius: 8px; background: var(--border); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.input:disabled { background: var(--light-gray2); color: var(--gray2); }
.field-error { color: #E53935; font-size: 10px; margin-top: 4px; }
.form-error { color: #E53935; font-size: 12px; margin-bottom: 16px; text-align: center; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 44px; }
.password-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border: 0; background: none; color: var(--dark-gray);
    display: flex; align-items: center; justify-content: center;
}

.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--dark-gray); }

/* チェックボックス（Flutter版と同じ: チェック時はアクア背景に白いチェック）
   accent-color だとブラウザがチェック色を自動で黒にするため自前で描画する */
.checkbox input[type="checkbox"],
.category-row input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    border: 2px solid var(--dark-gray2);
    border-radius: 2px;
    background: #fff center / 14px 14px no-repeat;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.checkbox input[type="checkbox"]:checked,
.category-row input[type="checkbox"]:checked {
    border-color: var(--aqua);
    background-color: var(--aqua);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round' d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.checkbox input[type="checkbox"]:focus-visible,
.category-row input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(26, 194, 222, .4);
    outline-offset: 2px;
}

/* スイッチ */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
    position: absolute; inset: 0; border-radius: 24px; background: var(--light-blue); transition: .2s; cursor: pointer;
}
.switch span::before {
    content: ""; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .2s;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + span { background: var(--aqua); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 12px; color: var(--text2); }

/* =========================================================================
   共通UI
   ========================================================================= */
.list > * + * { border-top: 1px solid var(--border); }
.divider { height: 1px; background: var(--border2); }
.divider-8 { height: 8px; background: var(--border2); }
.empty {
    padding: 64px 16px;
    text-align: center;
    color: var(--gray);
    font-size: 16px;
    white-space: pre-line;
}
.empty .btn { margin-top: 24px; }
.spinner {
    display: inline-block;
    width: 24px; height: 24px;
    border: 3px solid rgba(26, 194, 222, .25);
    border-top-color: var(--aqua);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.load-more { display: flex; justify-content: center; padding: 16px; }
.load-more a { color: var(--gray); font-size: 12px; text-decoration: underline; }
.loading-overlay {
    position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
}
.loading-overlay[hidden] { display: none; }

.chip {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 8px; color: var(--gray); background: rgba(153,153,153,.1);
    padding: 2px 4px; border-radius: 2px; white-space: nowrap;
}
.badge {
    display: inline-block; font-size: 8px; font-weight: 700; color: #fff;
    padding: 1px 4px; border-radius: 3px; white-space: nowrap; line-height: 1.5;
}
.heat { font-size: 8px; font-weight: 700; padding: 2px 5px; border-radius: 3px; white-space: nowrap; flex-shrink: 0; }
.avatar { border-radius: 50%; object-fit: cover; background: var(--light-gray2); flex-shrink: 0; display: block; }
.arrow-right { width: 10px; height: 10px; color: var(--dark-gray2); flex-shrink: 0; }

.snackbar {
    position: fixed; left: 50%; bottom: 80px; transform: translate(-50%, 20px);
    background: var(--aqua); color: #fff; font-size: 13px; text-align: center;
    padding: 12px 20px; border-radius: 8px; z-index: 1100; opacity: 0; pointer-events: none;
    transition: .25s; max-width: calc(100% - 32px);
}
.snackbar.is-show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================================
   ダイアログ
   ========================================================================= */
.dialog-backdrop {
    position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    animation: fadeIn .15s;
}
.dialog {
    width: 100%; max-width: 596px; background: #fff; border-radius: 6px; overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.dialog-header { background: var(--aqua); color: #fff; font-size: 16px; font-weight: 700; padding: 14px; text-align: center; }
.dialog-content { padding: 24px 32px; font-size: 16px; color: var(--text2); text-align: center; white-space: pre-line; }
.dialog-footer { padding: 0 32px 24px; display: flex; justify-content: center; }
.dialog-footer .btn { min-width: 121px; min-height: 32px; font-size: 12px; box-shadow: none; }
.dialog-buttons { display: flex; border-top: 1px solid var(--border2); }
.dialog-buttons button {
    flex: 1; height: 44px; background: none; border: 0; font-size: 12px; color: var(--dark-gray2);
}
.dialog-buttons button + button { border-left: 1px solid var(--border2); }
.dialog-buttons button.is-primary { color: var(--aqua); font-weight: 700; }
.dialog-login { padding: 24px 32px 32px; text-align: center; }
.dialog-login img { width: 140px; margin: 0 auto 16px; display: block; }
.dialog-login p { font-size: 16px; color: var(--text2); margin-bottom: 24px; }
.dialog-login .btn { width: 100%; min-width: 0; margin-top: 8px; }
.dialog-radio { padding: 16px 32px 24px; text-align: left; }
.dialog-radio p { font-size: 18px; color: var(--text2); margin-bottom: 12px; text-align: center; }
.dialog-radio label { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; cursor: pointer; }
.dialog-radio input { accent-color: var(--aqua); width: 18px; height: 18px; }
.dialog-buttons.tall button { height: 46px; }

/* アクションシート（iOS風） */
.sheet-backdrop {
    position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.4);
    display: flex; align-items: flex-end; justify-content: center; padding: 8px;
}
.sheet { width: 100%; max-width: 596px; animation: sheetIn .2s ease; }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
.sheet-group { background: rgba(255,255,255,.97); border-radius: 13px; overflow: hidden; margin-bottom: 8px; }
.sheet-group button {
    display: block; width: 100%; padding: 16px; border: 0; background: none;
    font-size: 20px; color: var(--ios-blue); text-align: center;
}
.sheet-group button + button { border-top: 1px solid #ddd; }
.sheet-group button.is-destructive { color: #FF3B30; }
.sheet-cancel { font-weight: 700; }

/* =========================================================================
   ログインが必要画面 / エラー画面
   ========================================================================= */
.no-login { max-width: 800px; margin: 0 auto; padding: 96px 32px; text-align: center; }
.no-login p { font-size: 16px; color: var(--text2); margin-bottom: 64px; }
.no-login .btn { width: 400px; max-width: 100%; margin-bottom: 8px; }
.no-login .btn-text { display: block; margin: 16px auto 0; }

/* =========================================================================
   カテゴリタブ（ホーム）
   ========================================================================= */
.cat-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
    flex-shrink: 0;
    padding: 12px 8px 8px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text2);
    letter-spacing: -0.5px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.cat-tab.is-active { font-size: 14px; font-weight: 700; border-bottom-color: #000; }
.cat-tab { transition: color .2s ease; }
/* JS有効時は下線をスライドするインジケーターで表示 */
.cat-tabs.has-indicator { position: relative; }
.cat-tabs.has-indicator .cat-tab { border-bottom-color: transparent; }
.cat-tabs .tabs-indicator { bottom: 0; }
#home-content { transition: opacity .15s; }
#home-content.is-loading { opacity: .4; pointer-events: none; }

/* =========================================================================
   スレッド一覧アイテム
   ========================================================================= */
.thread-list { padding: 0 16px 32px; }
.thread-item { position: relative; display: block; }
.thread-item-link { display: flex; align-items: center; gap: 10px; padding: 8px 0 8px 8px; }
.thread-item-link:hover { background: #fcfcfc; }
.thread-thumb {
    position: relative; width: 104px; height: 104px; flex-shrink: 0; border-radius: 4px; overflow: hidden;
    background: var(--light-gray2);
}
.thread-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thread-thumb img.cover { object-fit: cover; }
.play-icon {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
}
.thread-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.thread-title-row { display: flex; align-items: flex-start; gap: 6px; }
.thread-title {
    flex: 1; font-size: 12px; font-weight: 700; color: var(--text2); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all;
}
.thread-text {
    font-size: 10px; color: var(--dark-gray); font-weight: 400;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all;
}
.thread-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.thread-counts { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--gray); font-size: 10px; }
.thread-counts span { display: inline-flex; align-items: center; gap: 3px; color: var(--dark-gray); }
.thread-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--gray); font-weight: 400; }
.thread-arrow { color: var(--dark-gray2); flex-shrink: 0; }
.rank-badge {
    position: absolute; left: 0; top: 0; z-index: 2;
    min-width: 28px; height: 28px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.thread-overlay {
    position: absolute; inset: 0; z-index: 3;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    font-size: 12px; text-align: center;
}
.thread-overlay.is-deleted { background: rgba(229, 57, 53, .05); color: #E53935; }
.thread-overlay.is-locked { background: rgba(0,0,0,.7); color: #fff; cursor: pointer; border: 0; width: 100%; }

/* 総合タブ（カテゴリ別セクション） */
.general-section { padding: 16px 0 8px; }
.general-head { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 8px; }
.general-head h2 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.general-head a.more { font-size: 10px; font-weight: 700; color: var(--gray2); display: inline-flex; align-items: center; gap: 2px; }
.general-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px; scrollbar-width: thin; }
.general-card {
    position: relative; flex-shrink: 0; width: 130px; height: 130px; border-radius: 8px; border: 1px solid var(--border2);
    box-shadow: 0 2px 4px rgba(0,0,0,.05); overflow: hidden; display: flex; flex-direction: column; background: #fff;
}
.general-card-img { height: 65px; background: var(--light-gray2); display: flex; align-items: center; justify-content: center; color: var(--gray2); position: relative; }
.general-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.general-card-body { padding: 6px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.general-card-title {
    font-size: 10px; font-weight: 700; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.general-card-meta { margin-top: auto; display: flex; align-items: center; gap: 4px; font-size: 9px; color: var(--dark-gray); }
.general-card-meta .heat { font-size: 7px; padding: 1px 3px; margin-left: auto; }
.general-card .rank-badge { min-width: 24px; height: 24px; font-size: 11px; }

/* =========================================================================
   スレッド詳細
   ========================================================================= */
.thread-detail { padding: 8px 12px 120px; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin: 8px 0 12px; }
.cat-chip { font-size: 10px; color: var(--dark-gray); background: var(--border2); padding: 6px 12px; border-radius: 2px; }
.deleted-chip { font-size: 10px; color: var(--white1); background: var(--red2); padding: 6px 12px; border-radius: 2px; }
.tag-links { font-size: 12px; font-weight: 700; display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tag-links a { color: var(--ios-blue); }
.post-head { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--dark-gray); }
.post-head .num { margin-left: 4px; }
.post-head .uid { color: var(--gray2); }
.post-head .options { margin-left: auto; }
.options-btn {
    width: 32px; height: 24px; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center;
    color: var(--dark-gray); border-radius: 4px;
}
.options-btn:hover { background: var(--light-gray2); }
.detail-h1 { font-size: 16px; font-weight: 700; color: var(--text2); margin: 10px 0 0 38px; line-height: 1.5; word-break: break-all; }
.post-text { margin: 8px 0 0 38px; font-size: 12px; color: var(--text2); line-height: 1.5; font-weight: 400; word-break: break-word; }
.post-media { margin: 12px 0 0 38px; position: relative; display: inline-block; max-width: calc(100% - 38px); }
.post-media button { border: 0; padding: 0; background: none; display: block; position: relative; }
.post-media img { display: block; max-height: 500px; max-width: 100%; border-radius: 8px; object-fit: scale-down; }
.media-count {
    position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 4px;
    font-size: 11px; padding: 2px 6px; display: inline-flex; align-items: center; gap: 4px;
}
.citation {
    margin: 12px 0 0 38px; padding: 10px; background: #F8F8F0; border: 1px solid #E0E0D0; border-radius: 6px; display: block;
}
.citation-head { font-size: 10px; font-weight: 700; color: var(--gray2); display: flex; align-items: center; gap: 4px; }
.citation-url { font-size: 10px; color: var(--ios-blue); text-decoration: underline; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
.citation-site { display: flex; gap: 8px; margin-top: 8px; }
.citation-site img { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.citation-site strong { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.citation-site p { font-size: 10px; color: var(--gray2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-foot { margin: 12px 0 0 38px; display: flex; align-items: center; gap: 14px; font-size: 10px; color: var(--gray2); }
.post-foot .actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn {
    border: 0; background: none; padding: 4px; display: inline-flex; align-items: center; gap: 4px;
    color: var(--gray); font-size: 12px;
}
.icon-btn .count { color: var(--text2); }
.like-btn.is-liked .icon { color: #FF0000; }
.like-btn.pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }

/* コメント */
.comments { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.comment {
    border-radius: 6px; padding: 8px 2px 2px; transition: background .3s;
}
.comment.is-highlight { background-color: rgba(153,153,153,.15) !important; }
.comment-head { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--dark-gray); padding: 0 4px; }
.comment-head .uid { color: var(--gray2); }
.comment-head .options { margin-left: auto; }
.comment-text { margin: 8px 0 0 42px; line-height: 1.5; word-break: break-word; font-weight: 400; }
.reply-ref { color: var(--aqua); font-size: 12px; border: 0; background: none; padding: 0; margin-right: 4px; }
.comment-media { margin: 8px 0 0 42px; position: relative; display: inline-block; max-width: calc(100% - 42px); }
.comment-media button { border: 0; padding: 0; background: none; display: block; position: relative; }
.comment-media img { max-height: 300px; max-width: 100%; border-radius: 8px; display: block; }
.sensitive {
    width: 280px; max-width: 100%; height: 180px; border-radius: 8px;
    background: repeating-linear-gradient(45deg, #2b2b2b 0 12px, #353535 12px 24px);
    color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 700;
}
.sensitive a { font-size: 11px; text-decoration: underline; font-weight: 400; }
.comment-foot { margin: 4px 0 0 42px; display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--gray2); padding-right: 4px; }
.comment-foot .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.buzz { font-size: 8px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }

/* 最新のコメントを表示 */
.jump-latest {
    position: absolute; bottom: calc(100% + 16px); left: 50%; transform: translateX(-50%); white-space: nowrap;
    background: #fff; border: 0; border-radius: 32px; box-shadow: 0 2px 10px rgba(0,0,0,.15);
    padding: 8px 16px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; z-index: 35;
}

/* コメント入力欄 */
.composer { padding: 12px 16px; }
.composer-reply {
    display: flex; align-items: center; gap: 6px; background: var(--light-gray2); border-radius: 8px 8px 0 0;
    border-bottom: 1px solid var(--border2); padding: 6px 10px; font-size: 10px; color: var(--dark-gray2);
}
.composer-reply button { margin-left: auto; border: 0; background: none; color: var(--gray2); font-size: 16px; line-height: 1; }
.composer-input {
    width: 100%; border: 0; outline: none; background: var(--light-gray2); border-radius: 8px; padding: 12px 16px;
    font: inherit; font-size: 14px; resize: none; min-height: 44px; max-height: 160px; display: block;
}
.composer-reply + .composer-input { border-radius: 0 0 8px 8px; }
.composer-locked { display: flex; align-items: center; gap: 8px; color: var(--gray); cursor: pointer; }
.composer-files { display: flex; gap: 8px; padding-top: 8px; overflow-x: auto; }
.composer-file { position: relative; width: 69px; height: 69px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: var(--light-gray2); }
.composer-file img, .composer-file video { width: 100%; height: 100%; object-fit: cover; }
.composer-file button {
    position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0;
    background: rgba(0,0,0,.6); color: #fff; font-size: 12px; line-height: 1;
}
.composer-actions { display: flex; align-items: center; gap: 4px; padding-top: 8px; }
.composer-actions .send { margin-left: auto; }
.composer-actions .icon-btn { color: var(--dark-gray); }
.composer-actions .icon-btn.is-on { color: var(--aqua); }
.composer-actions .send:disabled { opacity: .3; cursor: not-allowed; }
.anim-panel { padding-top: 12px; }
.anim-panel h3 { font-size: 16px; font-weight: 500; margin-bottom: 8px; }
.anim-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.anim-grid button {
    height: 32px; border: 2px solid var(--light-gray); border-radius: 4px; background: #fff; font-size: 14px;
}
.anim-grid button.is-active { border-color: var(--aqua); }
.anim-preview {
    margin-top: 12px; background: var(--light-gray2); border-radius: 8px; min-height: 60px; padding: 12px;
    display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 16px;
}
.anim-detail-toggle { margin-top: 12px; border: 0; background: none; padding: 8px 0; display: flex; align-items: center; gap: 4px; width: 100%; border-top: 1px solid var(--border2); font-size: 14px; }
.color-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.color-swatch {
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,.1);
    box-shadow: 0 1px 2px rgba(0,0,0,.15); position: relative; padding: 0;
}
.color-swatch.is-active { outline: 2px solid var(--aqua); outline-offset: 2px; }

/* コメントアニメーション */
.anim { display: inline-block; }
.anim-0 { animation: animScale var(--anim-ms, 2000ms) ease both; }
.anim-1 { animation: animFall var(--anim-ms, 2000ms) cubic-bezier(.34,1.56,.64,1) both; }
.anim-2 { animation: animRotate var(--anim-ms, 2000ms) ease both; }
.anim-3 { animation: animFade var(--anim-ms, 2000ms) ease both; }
.anim-4 { animation: animFlicker var(--anim-ms, 2000ms) steps(1) both; }
.anim-6 { animation: animBrake var(--anim-ms, 2000ms) ease-in-out both; }
@keyframes animScale { 0% { transform: scale(0); } 50% { transform: scale(2); } 100% { transform: scale(1); } }
@keyframes animFall { from { transform: translateY(-200%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes animRotate { from { transform: rotate(0); } to { transform: rotate(720deg); } }
@keyframes animFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes animFlicker {
    0%, 20%, 40%, 60%, 80% { opacity: 0; }
    10%, 30%, 50%, 70%, 90%, 100% { opacity: 1; }
}
@keyframes animBrake {
    0% { transform: translateX(300%) skewX(0); }
    70% { transform: translateX(0) skewX(-20deg); }
    85% { transform: skewX(10deg); }
    100% { transform: none; }
}

/* メディアビューア */
.viewer {
    position: fixed; inset: 0; z-index: 950; background: #000; display: flex; flex-direction: column;
}
.viewer-top { display: flex; align-items: center; gap: 12px; color: #fff; padding: 12px 16px; }
.viewer-top button { border: 0; background: none; color: #fff; font-size: 26px; line-height: 1; padding: 4px 8px; }
.viewer-top .count { font-size: 20px; }
.viewer-top .close { margin-left: auto; }
.viewer-stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-stage iframe { width: 100%; height: 100%; max-width: 1000px; border: 0; }

/* =========================================================================
   検索
   ========================================================================= */
.search-bar { padding: 0 16px 8px; }
.search-field { position: relative; }
.search-field input {
    width: 100%; height: 40px; border-radius: 50px; border: 0; background: rgba(238,238,238,.5);
    padding: 0 40px; font: inherit; font-size: 14px; outline: none;
}
.search-field .icon-search { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray); }
.search-field .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--gray); font-size: 18px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tabs a, .tabs button {
    flex: 1; text-align: center; padding: 10px 0 8px; font-size: 14px; font-weight: 700; color: var(--gray2);
    border: 0; background: none; border-bottom: 2px solid transparent;
}
.tabs .is-active { color: var(--text); border-bottom-color: #000; }
.tabs a, .tabs button { transition: color .25s ease; }
/* スライドするインジケーター（JSで有効化。Flutter版 TabBar と同じ見た目） */
.tabs.has-indicator { position: relative; }
.tabs.has-indicator a, .tabs.has-indicator button { border-bottom-color: transparent; }
.tabs-indicator {
    position: absolute; left: 0; bottom: -1px; height: 2px; background: #000; pointer-events: none;
}
.tabs-indicator.is-ready { transition: transform .25s cubic-bezier(.4, 0, .2, 1), width .25s cubic-bezier(.4, 0, .2, 1); }
.search-results { transition: opacity .15s; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.rank-row:hover { background: #fcfcfc; }
.hex {
    width: 24px; height: 26px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    color: #fff; font-size: 11px; font-weight: 700;
}
.rank-main { flex: 1; min-width: 0; }
.rank-date { font-size: 8px; color: var(--gray); }
.rank-name { font-size: 14px; word-break: break-all; }
.rank-count { font-size: 10px; color: var(--dark-gray); }
.rank-thumb { width: 56px; height: 56px; border-radius: 4px; object-fit: cover; flex-shrink: 0; position: relative; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.user-row .uid { font-size: 10px; color: var(--gray2); }
.user-row .name { font-size: 14px; }

/* =========================================================================
   マイページ
   ========================================================================= */
.mypage { background: var(--white1); padding: 24px 16px; min-height: 100%; }
.card { background: #fff; border-radius: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.profile-card { padding: 20px; text-align: center; }
.profile-card .avatar { margin: 0 auto 12px; }
.profile-card .name { font-size: 18px; font-weight: 700; }
.profile-card .uid { font-size: 12px; color: var(--gray2); }
.profile-card .bio { font-size: 12px; color: var(--dark-gray); margin-top: 8px; white-space: pre-line; }
.profile-card .btn-edit {
    display: flex; align-items: center; justify-content: center; margin-top: 16px; height: 40px; border-radius: 20px;
    background: var(--white1); font-size: 14px; color: var(--text2);
}
.section-title { font-size: 14px; font-weight: 700; color: var(--dark-gray); margin: 24px 0 12px; }
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.menu-tile {
    background: #fff; border-radius: 16px; padding: 16px; display: flex; align-items: center; gap: 12px;
    font-size: 13px; font-weight: 700; white-space: pre-line; line-height: 1.4; box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.menu-tile .circle { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
@media (min-width: 900px) { .menu-grid { grid-template-columns: repeat(4, 1fr); } }
.menu-list { overflow: hidden; }
.menu-row {
    display: flex; align-items: center; gap: 12px; padding: 16px 20px; font-size: 14px; width: 100%;
    border: 0; background: none; text-align: left;
}
.menu-row:hover { background: #fcfcfc; }
.menu-row + .menu-row { border-top: 1px solid var(--border2); }
.menu-row .chev { margin-left: auto; color: var(--light-gray); }
.menu-row.is-red { color: var(--red); }
.menu-row.is-blue { color: var(--ios-blue); }

/* 汎用ページ余白 */
.page-pad { padding: 24px 16px; }
.narrow { max-width: 480px; margin: 0 auto; width: 100%; }
.content-narrow { max-width: 640px; margin: 0 auto; width: 100%; }
.footer-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--border2); padding: 12px 16px; }

/* =========================================================================
   認証画面
   ========================================================================= */
.auth { width: 100%; max-width: 480px; padding: 32px 42px 48px; }
.auth-logo { display: block; width: 166px; margin: 0 auto 16px; }
.auth-lead { text-align: center; font-size: 16px; color: var(--gray); margin-bottom: 40px; }
.auth .btn { width: 100%; min-width: 0; }
.auth .btn + .btn { margin-top: 8px; }
.auth-terms { display: flex; justify-content: center; margin-bottom: 24px; }
.auth-terms a { color: var(--aqua); text-decoration: underline; font-weight: 700; }
.auth-forgot { text-align: right; font-size: 12px; margin-top: -16px; margin-bottom: 40px; }
.auth-forgot a { color: var(--dark-gray); text-decoration: underline; }
.info-box { display: flex; gap: 10px; align-items: flex-start; padding: 16px; border-radius: 8px; background: rgba(190,202,216,.1); font-size: 12px; margin-bottom: 12px; }
.info-box.is-timer { background: rgba(190,202,216,.2); color: var(--aqua); font-weight: 700; }
.info-box.is-timer.is-expired { color: #E53935; }

/* =========================================================================
   スケルトン
   ========================================================================= */
.skeleton { background: linear-gradient(90deg, #f2f2f2 25%, #e8e8e8 37%, #f2f2f2 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* =========================================================================
   スマホ調整
   ========================================================================= */
@media (max-width: 768px) {
    .auth { padding: 24px 24px 48px; }
    .btn { min-width: 0; }
    .thread-detail { padding-bottom: 40px; }
}

/* =========================================================================
   画像の切り取り（cropper.js）
   ========================================================================= */
.crop-dialog { max-width: 640px; }
.crop-stage { background: #222; height: min(60vh, 480px); }
.crop-stage img { display: block; max-width: 100%; }
/* アバター用: 円形のガイド */
.crop-stage.is-round .cropper-view-box,
.crop-stage.is-round .cropper-face { border-radius: 50%; }
.crop-stage.is-round .cropper-view-box { outline: 0; box-shadow: 0 0 0 1px #39f; }

/* =========================================================================
   いいねのパーティクル
   ========================================================================= */
.burst-particle {
    position: fixed; z-index: 1200; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
    pointer-events: none; animation: burst .55s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes burst {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}

/* =========================================================================
   スレッドのプレビュー（長押し）
   ========================================================================= */
[data-preview] { -webkit-touch-callout: none; }
.preview-backdrop {
    position: fixed; inset: 0; z-index: 950; background: rgba(0, 0, 0, .7);
    display: flex; align-items: center; justify-content: center; padding: 48px 24px; animation: fadeIn .15s;
}
.preview-card {
    width: 100%; max-width: 480px; max-height: 70vh; overflow: hidden; background: #fff; border-radius: 12px;
    display: flex; flex-direction: column; animation: previewIn .2s ease;
}
@keyframes previewIn { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.preview-media { position: relative; background: #000; flex-shrink: 1; min-height: 0; display: flex; justify-content: center; }
.preview-media img { max-width: 100%; max-height: 40vh; object-fit: contain; display: block; }
.preview-text { padding: 16px; overflow: hidden; }
.preview-text h3 { font-size: 14px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.preview-text p { margin-top: 8px; font-size: 12px; color: var(--dark-gray); font-weight: 400; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
