@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;500;700&family=Noto+Sans+JP:wght@300;400;500&display=swap');

:root {
    --paper:        #faf7f2;
    --paper-mid:    #f2ece3;
    --paper-dark:   #e8dfd2;
    --ink:          #231e15;
    --ink-mid:      #4a4235;
    --ink-light:    #7a6e5f;
    --ink-faint:    #b0a494;
    --accent:       #7a3b1e;
    --accent-warm:  #b85c2a;
    --accent-pale:  #f5e6d8;
    --accent-glow:  rgba(122, 59, 30, 0.12);
    --green:        #3d6b4f;
    --red:          #8b2e2e;
    --border:       #ddd5c6;
    --border-light: #ede6db;
    --shadow-sm:    0 1px 4px rgba(35, 30, 21, 0.06);
    --shadow-md:    0 4px 16px rgba(35, 30, 21, 0.10);
    --shadow-lg:    0 8px 32px rgba(35, 30, 21, 0.14);
    --radius:       10px;
    --radius-sm:    6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: var(--paper);
    background-image:
        linear-gradient(var(--border-light) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
    background-size: 40px 40px;
    color: var(--ink);
    line-height: 1.8;
    min-height: 100vh;
}

/* ============================
   HEADER
   ============================ */
header {
    background: rgba(250, 247, 242, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    box-shadow: var(--shadow-sm);
}

.header-logo {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo::before {
    content: '✒';
    font-size: 1rem;
    opacity: 0.75;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================
   BUTTONS
   ============================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(122, 59, 30, 0.28);
}
.btn-primary:hover {
    background: var(--accent-warm);
    box-shadow: 0 4px 14px rgba(122, 59, 30, 0.36);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}
.btn-outline:hover {
    background: var(--accent-pale);
    border-color: var(--accent-warm);
}

.btn-danger {
    background: transparent;
    color: var(--red);
    border: 1.5px solid var(--red);
}
.btn-danger:hover { background: #fdf0f0; }

.btn-back {
    color: var(--ink-light);
    text-decoration: none;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
    padding: 6px 0;
}
.btn-back:hover { color: var(--accent); }

/* ============================
   MAIN LAYOUT
   ============================ */
main {
    max-width: 820px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

/* ============================
   SEARCH BAR
   ============================ */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
}

.search-input {
    flex: 1;
    padding: 11px 18px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--ink);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-sm);
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-input::placeholder { color: var(--ink-faint); }

/* ============================
   TAG FILTER
   ============================ */
.tag-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 36px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.tag-filter-label {
    font-size: 0.7rem;
    color: var(--ink-faint);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 500;
    margin-right: 4px;
}

.tag {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--ink-light);
    padding: 4px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.78rem;
    transition: all 0.18s ease;
    letter-spacing: 0.03em;
}
.tag:hover {
    border-color: var(--accent-warm);
    color: var(--accent-warm);
    background: var(--accent-pale);
}
.tag.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(122, 59, 30, 0.22);
}

/* ============================
   ENTRIES HEADER
   ============================ */
.entries-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.entries-count {
    font-size: 0.78rem;
    color: var(--ink-faint);
    letter-spacing: 0.05em;
}

/* ============================
   ENTRY CARDS
   ============================ */
.entries {
    display: grid;
    gap: 14px;
}

.entry-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.entry-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
    background: linear-gradient(to bottom, var(--accent-warm), var(--accent));
    opacity: 0.55;
    transition: opacity 0.2s, width 0.2s;
}

.entry-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-pale);
}
.entry-card:hover::before {
    opacity: 1;
    width: 6px;
}

.entry-card-inner {
    padding: 22px 26px 22px 30px;
}

.entry-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.entry-date {
    font-size: 0.73rem;
    color: var(--ink-faint);
    letter-spacing: 0.06em;
}

.entry-mood-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}

.mood-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s;
}
.mood-dot.filled { background: var(--accent-warm); }

.entry-card h2 {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 8px;
    line-height: 1.6;
    transition: color 0.2s;
}
.entry-card:hover h2 { color: var(--accent); }

.entry-card p {
    font-size: 0.855rem;
    color: var(--ink-light);
    line-height: 1.75;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.entry-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.entry-tag {
    background: var(--paper-mid);
    color: var(--ink-light);
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    border: 1px solid var(--border-light);
}

/* ============================
   EMPTY STATE
   ============================ */
.empty-state {
    text-align: center;
    padding: 90px 24px;
    color: var(--ink-faint);
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    display: block;
    opacity: 0.7;
}

.empty-state h3 {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.15rem;
    color: var(--ink-light);
    margin-bottom: 10px;
    font-weight: 500;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 28px;
    line-height: 1.7;
}

/* ============================
   FORM — PAGE TITLE
   ============================ */
.page-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.04em;
}

/* ============================
   FORM — CARD
   ============================ */
.form-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 44px 48px;
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 28px;
}

.form-group label {
    display: block;
    font-size: 0.73rem;
    font-weight: 500;
    color: var(--ink-light);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.form-group input[type=text],
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--paper);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--ink);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    line-height: 1.8;
}

.form-group input[type=text]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea {
    resize: vertical;
    min-height: 260px;
    font-size: 0.95rem;
    line-height: 2;
}

.form-hint {
    font-size: 0.73rem;
    color: var(--ink-faint);
    margin-top: 7px;
    letter-spacing: 0.02em;
}

/* ============================
   MOOD SELECTOR
   ============================ */
.mood-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mood-option input { display: none; }

.mood-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 18px;
    background: var(--paper);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.73rem;
    color: var(--ink-faint);
    letter-spacing: 0.03em;
    font-weight: 400;
    min-width: 68px;
    text-align: center;
}

.mood-option label:hover {
    border-color: var(--accent-warm);
    background: var(--accent-pale);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.mood-option input:checked + label {
    border-color: var(--accent);
    background: var(--accent-pale);
    color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    font-weight: 500;
}

.mood-emoji { font-size: 1.6rem; line-height: 1; }

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    margin-top: 12px;
}

/* ============================
   VIEW PAGE
   ============================ */
.view-header {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.view-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.view-date {
    font-size: 0.82rem;
    color: var(--ink-faint);
    letter-spacing: 0.06em;
}

.view-mood {
    font-size: 0.82rem;
    color: var(--ink-light);
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--paper-mid);
    padding: 3px 12px;
    border-radius: 14px;
    border: 1px solid var(--border-light);
}

.view-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.85rem;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.55;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.view-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.view-body {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 52px;
    font-family: 'Noto Serif JP', serif;
    font-size: 1rem;
    line-height: 2.1;
    color: var(--ink-mid);
    white-space: pre-wrap;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.view-body::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
    background: linear-gradient(to bottom, var(--accent-warm), var(--accent));
    border-radius: var(--radius) 0 0 var(--radius);
    opacity: 0.4;
}

.view-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================
   NOTIFY BUTTON
   ============================ */
.btn-notify {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--ink-light);
    padding: 7px 10px;
    font-size: 1rem;
    line-height: 1;
    transition: all 0.2s;
}
.btn-notify:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--accent-pale);
}
.btn-notify.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-pale);
}
.btn-notify:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================
   HEADER USER
   ============================ */
.header-user {
    font-size: 0.8rem;
    color: var(--ink-light);
    letter-spacing: 0.04em;
    padding: 6px 12px;
    background: var(--paper-mid);
    border: 1px solid var(--border-light);
    border-radius: 20px;
}

/* ============================
   LOGIN PAGE
   ============================ */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 52px 48px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 28px;
}

.login-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--ink);
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: 0.04em;
}

.login-desc {
    font-size: 0.8rem;
    color: var(--ink-faint);
    text-align: center;
    margin-bottom: 28px;
}

.login-form { margin-top: 24px; }

.login-error {
    background: #fdf0f0;
    border: 1px solid #e8c4c4;
    color: var(--red);
    font-size: 0.82rem;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    text-align: center;
}

.login-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 0.9rem;
    margin-top: 8px;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 640px) {
    header { padding: 0 16px; }
    main { padding: 28px 16px 60px; }

    .form-card { padding: 28px 20px; }
    .view-body { padding: 28px 22px; }
    .view-title { font-size: 1.4rem; }
    .view-body::before { display: none; }

    .mood-selector { gap: 8px; }
    .mood-option label { padding: 10px 12px; min-width: 58px; }
    .mood-emoji { font-size: 1.4rem; }

    .tag-filter { padding: 12px 14px; }
    .entry-card-inner { padding: 18px 18px 18px 22px; }
}
