@charset "UTF-8";

:root {
    --bg-main: #0a0a0a;
    --bg-surface: #1a1a1a;
    --text-main: #e0e0e0;
    --text-sub: #888888;
    --color-gold: #c5a059;
    --color-gold-dim: rgba(197, 160, 89, 0.3);
    --font-serif: 'Noto Serif JP', serif;
    --font-sans: 'Noto Sans JP', sans-serif;
}

/* PC版で外側の余白背景を漆黒にする */
html {
    background-color: #000;
}

/* PC版でも最大幅480pxに固定して画面中央に配置する */
body {
    margin: 0 auto;
    padding: 0;
    max-width: 480px;
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

/* アプリの中身全体を「スマホサイズ」の箱に閉じ込める */
#app-main-content {
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--bg-main);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
    overflow-x: hidden;
}

/* ==========================================
   ログイン・会員登録画面 (Auth Screen)
   ========================================== */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: 480px;
    width: 100%;
    height: 100%;
    background-color: var(--bg-main);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 40px 20px;
}

.auth-container .logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==========================================
   ヘッダー＆ナビゲーション
   ========================================== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: 480px;
    width: 100%;
    background-color: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    border-bottom: 1px solid #222;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    padding: 0 15px;
}

.header-side-icon {
    width: 40px;
    display: flex;
    align-items: center;
}

.header-kamon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo-main {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-gold);
    letter-spacing: 2px;
}

.logo-sub {
    font-family: var(--font-sans);
    font-size: 0.55rem;
    color: var(--text-sub);
    letter-spacing: 1px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: 480px;
    width: 100%;
    height: 65px;
    background-color: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #333;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-sub);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    width: 20%;
    padding: 5px 0;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--color-gold);
}

.nav-kanji {
    font-family: var(--font-serif);
    font-size: 1.2rem;
}

.nav-label {
    font-size: 0.6rem;
}

.btn-center {
    position: relative;
    top: -15px;
    background-color: var(--color-gold);
    color: #000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(197, 160, 89, 0.3);
}

.btn-center.active {
    color: #000;
}

/* ==========================================
   メインレイアウト
   ========================================== */
#app-views-container {
    padding-top: 56px;
    padding-bottom: 80px;
}

.app-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.app-view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==========================================
   タイムライン (Post)
   ========================================== */
.post {
    background-color: var(--bg-surface);
    margin-bottom: 15px;
    border-bottom: 1px solid #222;
}

.post-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
}

.post-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.post-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-author {
    font-size: 0.9rem;
    font-weight: 500;
}

.post-date {
    font-size: 0.7rem;
    color: var(--text-sub);
}

.post-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 0.65rem;
    border: 1px solid var(--color-gold);
    color: var(--color-gold);
    padding: 2px 6px;
    border-radius: 3px;
}

.post-badge-pr {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 0.65rem;
    border: 1px solid #444;
    color: #888;
    padding: 2px 6px;
    border-radius: 3px;
}

.post-body {
    display: flex;
    cursor: pointer;
    align-items: stretch;
}

.post-image-half {
    width: 60%;
    display: flex;
}

.post-image-half img {
    width: 100%;
    height: auto;
    aspect-ratio: 4/5;
    object-fit: cover;
    display: block;
}

.post-washi-half {
    width: 40%;
    background-color: #f4f1eb;
    color: #2c2c2c;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background-image: url('https://www.transparenttextures.com/patterns/rice-paper.png');
}

.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 2;
    letter-spacing: 2px;
    margin: 0;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
}

.action-group-left {
    display: flex;
    gap: 15px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 5px;
}

.action-btn .material-symbols-outlined {
    font-size: 1.2rem;
}

/* ==========================================
   フォーム・UIパーツ
   ========================================== */
.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-bottom: 5px;
}

.custom-textarea {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid #333;
    color: var(--text-main);
    padding: 12px;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.custom-textarea:focus {
    outline: none;
    border-color: var(--color-gold);
}

.washi-submit-btn {
    background: var(--color-gold);
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

.washi-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--color-gold);
}

input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================
   モーダル共通
   ========================================== */
.detail-modal,
.compose-modal,
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: 480px;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.detail-modal.open,
.compose-modal.open,
.crop-modal.open {
    transform: translateY(0);
}

.icon-btn,
.close-btn,
.submit-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.submit-btn {
    color: var(--color-gold);
    font-weight: bold;
    font-size: 1rem;
}

/* ==========================================
   詳細モーダル (カルテ)
   ========================================== */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #222;
    background: rgba(10, 10, 10, 0.9);
}

.detail-content-scroll {
    flex: 1;
    overflow-y: auto;
}

.detail-image-area img {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: cover;
    display: block;
}

.detail-info-area {
    padding: 20px 15px;
}

.detail-author-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
}

.detail-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
}

.detail-author-name {
    font-weight: bold;
    font-size: 0.95rem;
}

.detail-post-date {
    font-size: 0.75rem;
    color: var(--text-sub);
}

.detail-title {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    margin: 0 0 10px 0;
}

.detail-divider,
.detail-divider-solid {
    border: none;
    border-top: 1px dashed #333;
    margin: 15px 0;
}

.detail-divider-solid {
    border-top: 1px solid #222;
}

.detail-karte {
    background: var(--bg-surface);
    padding: 15px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.karte-row {
    display: flex;
    margin-bottom: 8px;
}

.karte-row:last-child {
    margin-bottom: 0;
}

.karte-label {
    width: 80px;
    color: var(--text-sub);
}

.karte-value {
    flex: 1;
    color: var(--text-main);
}

/* Tabs */
.detail-tabs,
.m-tabs {
    display: flex;
    border-bottom: 1px solid #333;
}

.d-tab,
.m-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-sub);
    padding: 12px 0;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.d-tab.active,
.m-tab.active {
    color: var(--color-gold);
    border-bottom-color: var(--color-gold);
    font-weight: bold;
}

.dtab-content,
.mtab-content {
    display: none;
    padding: 15px 0;
}

.dtab-content.active,
.mtab-content.active {
    display: block;
}

/* 本文＆コメント */
.washi-poem-horizontal {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--color-gold);
    text-align: center;
    padding: 20px;
    background: var(--bg-surface);
    border-radius: 4px;
}

.long-comment-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #ccc;
    white-space: pre-wrap;
    margin-top: 15px;
}

.reply-card-washi {
    display: flex;
    margin-bottom: 15px;
}

.reply-card-washi img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.reply-user {
    font-size: 0.85rem;
    font-weight: bold;
}

.reply-date {
    font-size: 0.7rem;
    color: var(--text-sub);
}

.reply-text-washi {
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

.reply-input-area-washi {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.washi-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid #333;
    color: var(--text-main);
    padding: 10px;
    border-radius: 4px;
}

/* ==========================================
   詠む（投稿）モーダル & 蔵登録モーダル
   ========================================== */
.compose-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-surface);
    border-bottom: 1px solid #222;
}

.compose-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.compose-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* プレビューエリアをタイムラインと全く同じ比率・構造にする */
.compose-preview-block {
    display: flex;
    align-items: stretch;
    /* 左右の高さを画像に強制同期 */
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #333;
    position: relative;
}

.compose-image-half {
    width: 60%;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

/* タイムラインの画像と全く同じ比率計算を適用 */
.compose-image-half img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    display: block;
}

#upload-placeholder {
    text-align: center;
}

.change-photo-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.compose-washi-half {
    width: 40%;
    background-color: #f4f1eb;
    background-image: url('https://www.transparenttextures.com/patterns/rice-paper.png');
    position: relative;
    /* textareaを絶対配置して追従させる基礎 */
}

/* textarea自身の高さで親枠を押し広げないように絶対配置化 */
.washi-textarea-vertical {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 2;
    padding: 15px;
    color: #2c2c2c;
}

.washi-textarea-vertical:focus {
    outline: none;
}

.washi-char-counter {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: #888;
    font-size: 0.7rem;
    font-family: var(--font-sans);
    background: rgba(244, 241, 235, 0.8);
    padding: 2px 5px;
    border-radius: 3px;
    z-index: 5;
}

.compose-opt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #222;
}

.opt-label {
    font-size: 0.9rem;
}

.opt-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.opt-select {
    appearance: none;
    background: transparent;
    border: none;
    color: var(--color-gold);
    font-size: 0.9rem;
    padding-right: 20px;
    text-align: right;
    cursor: pointer;
}

.opt-select:focus {
    outline: none;
}

.opt-icon {
    position: absolute;
    right: 0;
    pointer-events: none;
    color: var(--color-gold);
    font-size: 1.2rem;
}

/* ==========================================
   マイページ (庵)
   ========================================== */
.mypage-custom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
}

.mypage-header-title {
    text-align: center;
}

.mypage-header-title .kanji {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--color-gold);
}

.mypage-header-title .kana {
    font-size: 0.6rem;
    color: var(--text-sub);
    letter-spacing: 2px;
}

.mypage-profile-area {
    padding: 0 20px 20px;
}

.mp-top {
    display: flex;
    align-items: center;
}

.mp-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
}

.mp-info {
    flex: 1;
}

.mp-name {
    font-size: 1.2rem;
    font-weight: bold;
}

.mp-handle {
    font-size: 0.8rem;
    color: var(--text-sub);
}

.mp-stats {
    display: flex;
    justify-content: space-between;
    background: var(--bg-surface);
    padding: 15px;
    border-radius: 8px;
}

.mp-stat {
    text-align: center;
    flex: 1;
}

.mp-stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-sub);
    margin-bottom: 5px;
}

.mp-stat-num {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-gold);
}

.my-bonsai-card {
    display: flex;
    background: var(--bg-surface);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    align-items: center;
}

.my-bonsai-img {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 15px;
}

.my-bonsai-info {
    flex: 1;
}

.mb-name {
    font-weight: bold;
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.mb-detail {
    font-size: 0.75rem;
    color: var(--text-sub);
}

/* ==========================================
   巡（探す）画面
   ========================================== */
.search-section {
    padding: 15px;
    background: var(--bg-surface);
}

.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-sub);
}

.search-input {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid #333;
    padding: 12px 12px 12px 40px;
    border-radius: 20px;
    color: var(--text-main);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-gold);
}

.meguri-section-title {
    font-size: 1rem;
    margin: 20px 15px 10px;
    color: var(--color-gold);
}

.tags-container {
    padding: 0 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.bonsai-tag {
    background: var(--bg-surface);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid #333;
}

.history-item {
    display: flex;
    background: var(--bg-surface);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.history-thumbnail img {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 12px;
}

.history-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.history-date {
    font-size: 0.7rem;
    color: var(--text-sub);
    margin-bottom: 3px;
}

.history-text {
    font-size: 0.85rem;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-metrics {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    font-size: 0.7rem;
    color: var(--text-sub);
}