:root {
  color-scheme: light;
  --bg: #f4efe6;
  --panel: #fffaf4;
  --panel-strong: #fff;
  --line: #dccdb7;
  --ink: #211c16;
  --muted: #6f6354;
  --accent: #cb5f43;
  --accent-strong: #a84630;
  --accent-soft: #f4cdbb;
  --danger: #9d2b2b;
  --shadow: 0 18px 40px rgba(72, 46, 27, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Noto Sans JP", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, #fff4e6 0%, transparent 35%),
    linear-gradient(180deg, #f9f4ec 0%, var(--bg) 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 32px;
  align-items: start;
  padding: 24px 0 20px;
}

.hero-copy {
  min-width: 0;
  padding-right: 12px;
}

.hero-tools {
  display: grid;
  gap: 10px;
  justify-items: end;
  align-self: start;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.83rem;
  letter-spacing: 0.08em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 6vw, 4.5rem);
  line-height: 0.98;
  max-width: 11ch;
}

.hero-subtitle {
  margin: 16px 0 0;
  max-width: 56ch;
  color: var(--muted);
  line-height: 1.6;
}

.language-switcher {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 8px;
  align-self: start;
  justify-self: end;
}

.lang-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.18s ease;
}

.lang-button {
  background: var(--panel);
  color: var(--muted);
  border-color: var(--line);
  min-width: 56px;
}

.lang-button.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.panel {
  background: rgba(255, 250, 244, 0.92);
  border: 1px solid rgba(220, 205, 183, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-top: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-form,
.entry-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.auth-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.auth-panel-compact {
  width: 100%;
  max-width: 280px;
  padding: 14px;
  margin-top: 0;
  box-shadow: 0 10px 24px rgba(72, 46, 27, 0.06);
}

.auth-panel-compact h2 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.auth-panel-compact .muted {
  font-size: 0.88rem;
  line-height: 1.45;
}

.auth-form-compact {
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

.auth-form-compact button {
  width: 100%;
}

.auth-form-compact label {
  gap: 6px;
}

.auth-form-compact input {
  padding: 10px 12px;
}

.entry-form label,
.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel-strong);
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 180px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px rgba(203, 95, 67, 0.2);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.secondary-button:hover,
.lang-button:hover {
  background: #f6ede4;
}

.danger-button {
  background: transparent;
  border-color: rgba(157, 43, 43, 0.24);
  color: var(--danger);
}

.danger-button:hover {
  background: rgba(157, 43, 43, 0.08);
}

.entries-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.entries-filter {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
}

.entries-filter select {
  min-width: 88px;
  background: var(--panel-strong);
  color: var(--ink);
}

.entry-card {
  padding: 18px;
  border-radius: 8px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.entry-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.entry-author {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}

.entry-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.entry-body {
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.entry-body > :first-child {
  margin-top: 0;
}

.entry-body > :last-child {
  margin-bottom: 0;
}

.status-line,
.empty-state,
.error-box {
  margin: 0;
  color: var(--muted);
}

.flash-area {
  margin-top: 18px;
}

.flash-area .status-line,
.flash-area .error-box {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.error-box {
  color: var(--danger);
}

.logged-in-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.auth-panel-compact .logged-in-box {
  margin-top: 12px;
  gap: 10px;
}

.auth-panel-compact .status-line {
  font-size: 0.92rem;
  line-height: 1.4;
}

.auth-panel-compact .secondary-button,
.auth-panel-compact .primary-button {
  min-height: 38px;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 980px);
    padding-top: 24px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-tools {
    justify-items: stretch;
  }

  .auth-panel-compact {
    max-width: none;
  }

  .auth-form {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .entry-head,
  .logged-in-box {
    flex-direction: column;
    align-items: stretch;
  }

  .lang-button {
    min-width: 0;
  }
}
