:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --bg-2: #eef5f1;
  --panel: #fffdf8;
  --panel-soft: #f3eadf;
  --text: #24231f;
  --muted: #6f6c64;
  --line: #ded6c8;
  --accent: #2f796f;
  --accent-2: #c66f4a;
  --accent-3: #6b5b95;
  --accent-soft: #dcebe7;
  --private: #9b4053;
  --friend: #5967a5;
  --shadow: 0 18px 48px rgba(67, 51, 36, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111312;
  --bg-2: #171b1f;
  --panel: #1c1d1a;
  --panel-soft: #27251f;
  --text: #f1eee6;
  --muted: #aaa69b;
  --line: #36342e;
  --accent: #83c9bd;
  --accent-2: #e0a077;
  --accent-3: #b5a7df;
  --accent-soft: #203831;
  --private: #e098a6;
  --friend: #aab4ec;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 14%, transparent), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.6;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  height: 100vh;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-link {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}

.nav-link:hover,
.nav-link.is-active {
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-2) 12%, var(--panel-soft)));
  color: var(--text);
}

.account-panel,
.tool-panel,
.about-block,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
}

.account-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.account-panel label {
  color: var(--muted);
  font-size: 13px;
}

.account-panel select,
select,
textarea,
input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.account-panel select,
select,
input[type="text"] {
  min-height: 42px;
  padding: 8px 10px;
}

.account-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.theme-toggle,
.text-button,
.primary-action,
.back-button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: auto;
  background: var(--panel);
}

.text-button,
.back-button {
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--panel));
}

.primary-action {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent-3) 50%, var(--accent)));
  color: #fff;
}

.text-button:hover,
.theme-toggle:hover,
.back-button:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}

.main {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 38px clamp(28px, 5vw, 72px) 52px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  margin-bottom: 26px;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 14px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  align-items: stretch;
}

.lede {
  max-width: 710px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 20px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-tags span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
  color: var(--muted);
  font-size: 14px;
}

.hero-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel div {
  padding: 22px;
  border-left: 1px solid var(--line);
}

.hero-panel div:first-child {
  border-left: 0;
}

.hero-panel strong {
  display: block;
  font-size: 32px;
  line-height: 1;
}

.hero-panel span {
  color: var(--muted);
  font-size: 13px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin: 34px 0 18px;
}

.section-head span {
  color: var(--muted);
  font-size: 14px;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.content-list,
.timeline {
  display: grid;
  gap: 12px;
  max-width: 980px;
  margin: 0 auto;
}

.entry-card,
.entry-row,
.timeline-item,
.photo-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  text-align: left;
}

.clickable-card {
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.clickable-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: var(--shadow);
}

.floating-create {
  position: fixed;
  left: calc(276px + (100vw - 276px) / 2);
  bottom: 32px;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  transform: translateX(-50%);
  border: 1px solid color-mix(in srgb, var(--accent) 58%, var(--line));
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent-2) 42%, var(--accent)));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(47, 121, 111, 0.28);
  z-index: 20;
}

.floating-create span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  font-size: 38px;
  line-height: 1;
  transform: translateY(-2px);
}

.floating-create:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 20px 42px rgba(47, 121, 111, 0.34);
}

.entry-card {
  position: relative;
  min-height: 220px;
  padding: 18px;
  overflow: hidden;
}

.entry-card::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -44px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 16%, transparent);
}

.entry-row,
.timeline-item {
  padding: 18px;
}

.entry-card p,
.entry-row p,
.timeline-item p,
.photo-body p {
  margin-bottom: 0;
  color: var(--muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
}

.badge.private {
  color: var(--private);
}

.badge.friend {
  color: var(--friend);
}

.badge.public {
  color: var(--accent);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.photo-card {
  overflow: hidden;
  padding: 0;
}

.photo-visual,
.detail-photo {
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 35%, transparent), transparent 55%),
    linear-gradient(315deg, color-mix(in srgb, var(--accent-3) 24%, transparent), var(--panel-soft));
}

.photo-2 {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--private) 30%, transparent), transparent 52%),
    linear-gradient(315deg, color-mix(in srgb, #8ca36d 26%, transparent), var(--panel-soft));
}

.photo-3 {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 34%, transparent), transparent 50%),
    linear-gradient(315deg, color-mix(in srgb, var(--accent) 18%, transparent), var(--panel-soft));
}

.photo-4 {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--friend) 32%, transparent), transparent 55%),
    linear-gradient(315deg, color-mix(in srgb, #d2a43f 22%, transparent), var(--panel-soft));
}

.photo-body {
  padding: 14px;
}

.back-button {
  margin-bottom: 16px;
}

.detail-panel {
  max-width: 820px;
  padding: 26px;
}

.detail-panel h2 {
  margin-bottom: 18px;
  font-size: clamp(28px, 5vw, 48px);
}

.detail-body {
  color: var(--text);
  font-size: 18px;
  white-space: pre-wrap;
}

.detail-photo {
  margin: -26px -26px 24px;
  border-radius: 8px 8px 0 0;
}

.discipline-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tool-panel {
  padding: 18px;
}

.memo-panel {
  border-top: 4px solid var(--accent);
}

.todo-panel {
  border-top: 4px solid var(--accent-2);
}

.workout-panel {
  border-top: 4px solid var(--accent-3);
}

.tool-panel.wide {
  grid-column: 1 / -1;
}

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

.tool-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

textarea {
  min-height: 220px;
  resize: vertical;
  padding: 12px;
}

.tool-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.inline-form,
.workout-form {
  display: grid;
  gap: 10px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.workout-form {
  grid-template-columns: minmax(0, 1fr) minmax(160px, 240px) auto;
}

.check-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.check-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.check-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.check-item span {
  overflow-wrap: anywhere;
}

.check-item.is-done span {
  color: var(--muted);
  text-decoration: line-through;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.count-pill {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.habit-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.habit-day {
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.habit-day.is-active {
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  background: var(--accent-soft);
}

.habit-day strong,
.habit-day span {
  display: block;
}

.habit-day strong {
  font-size: 13px;
}

.habit-day span {
  color: var(--muted);
  font-size: 12px;
}

.compact {
  gap: 8px;
}

.about-block {
  max-width: 760px;
  padding: 24px;
}

.about-block p {
  color: var(--muted);
}

dl {
  display: grid;
  gap: 12px;
  margin: 22px 0 0;
}

dl div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--text);
  font-weight: 700;
}

dd {
  margin: 0;
  color: var(--muted);
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.compose-dialog {
  width: min(920px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.compose-dialog::backdrop {
  background: rgba(20, 18, 14, 0.48);
  backdrop-filter: blur(6px);
}

.compose-form {
  display: grid;
  gap: 16px;
  padding: 12px;
}

.compose-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

#entryBody {
  min-height: 340px;
  font-size: 17px;
}

.emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emoji-row button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 20px;
}

.emoji-row button:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: var(--panel-soft);
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-link {
    text-align: center;
  }

  .main {
    padding: 28px 18px 40px;
  }

  .floating-create {
    left: 50%;
    bottom: 22px;
  }

  .topbar,
  .hero,
  .content-grid,
  .photo-grid,
  .discipline-layout,
  .workout-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .tool-panel.wide {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-head,
  .form-grid,
  .inline-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

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

  .hero-panel div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .hero-panel div:first-child {
    border-top: 0;
  }

  .habit-week {
    grid-template-columns: repeat(2, 1fr);
  }
}
