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

:root {
  --bg: #fff;
  --text: #000;
  --text-secondary: #666;
  --text-muted: #999;
  --link: #66a0d9;
  --link-hover: #4a8bc2;
  --border: #000;
  --input-bg: #fff;
  --button-hover: #f5f5f5;
}

:root.dark {
  --bg: #252527;
  --text: #e0e0e0;
  --text-secondary: #999;
  --text-muted: #777;
  --link: #7ab3e8;
  --link-hover: #9cc5f0;
  --border: #555;
  --input-bg: #333;
  --button-hover: #3a3a3c;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: flex;
  align-items: center;
  min-height: 100vh;
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px;
  gap: 48px;
}

nav {
  flex-shrink: 0;
  width: 100px;
}

nav .name {
  font-size: 15px;
  font-weight: normal;
  margin-bottom: 28px;
  line-height: 1.35;
}

nav .name a {
  text-decoration: none;
  color: var(--text);
}

nav .name a:hover {
  text-decoration: underline;
}

nav .alias {
  margin-top: 2px;
}

nav ul {
  list-style: none;
}

nav li {
  margin-bottom: 4px;
}

nav a {
  text-decoration: none;
  color: var(--text);
}

nav a:hover,
nav a.active {
  text-decoration: underline;
}

.theme-toggle {
  margin-top: 20px;
  font-family: inherit;
  font-size: 13px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}

.theme-toggle:hover {
  color: var(--text);
}

main {
  flex: 1;
  min-width: 0;
  max-width: 580px;
}

main a {
  color: var(--link);
}

main a:hover {
  color: var(--link-hover);
}

main h1 {
  font-size: 15px;
  font-weight: normal;
  margin-bottom: 20px;
}

main p {
  margin-bottom: 12px;
}

main p:last-child {
  margin-bottom: 0;
}

main h2 {
  font-size: 15px;
  font-weight: normal;
  color: var(--text-secondary);
  margin-top: 24px;
  margin-bottom: 10px;
}

main h2:first-of-type {
  margin-top: 0;
}

.essay-list,
.reading-list {
  list-style: none;
}

.essay-list li,
.reading-list li {
  margin-bottom: 10px;
}

.essay-list .date {
  color: var(--text-secondary);
  margin-right: 8px;
}

.essay-list a,
.reading-list a {
  color: var(--link);
  text-decoration: none;
}

.essay-list a:hover,
.reading-list a:hover {
  text-decoration: underline;
}

.reading-list .author {
  color: var(--text-secondary);
}

blockquote {
  border-left: 4px solid var(--text-secondary);
  margin: 16px 0;
  padding: 12px 0 12px 20px;
  display: block;
}

blockquote p {
  margin-bottom: 8px;
}

blockquote p:last-child {
  margin-bottom: 0;
  color: var(--text-secondary);
}

article h1 {
  margin-bottom: 24px;
}

article .meta {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

article p {
  margin-bottom: 16px;
}

.portfolio {
  list-style: none;
  margin-top: 16px;
}

.portfolio li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.portfolio .ticker {
  min-width: 44px;
}

.portfolio .buy-price {
  color: var(--text-secondary);
  min-width: 72px;
  text-align: right;
}

.portfolio .arrow {
  color: var(--text-muted);
}

.portfolio .current-price {
  min-width: 88px;
  text-align: right;
}

.portfolio .gain {
  min-width: 64px;
  text-align: right;
}

.portfolio .gain.positive {
  color: #22c55e;
}

.portfolio .gain.negative {
  color: #ef4444;
}

.portfolio-note {
  color: var(--text-secondary);
  font-style: italic;
}

.market-status {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 16px;
}

.room-gate {
  max-width: 280px;
}

.room-gate label {
  display: block;
  margin-bottom: 8px;
}

.room-gate input[type="password"] {
  font-family: inherit;
  font-size: 15px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  width: 100%;
  margin-bottom: 12px;
}

.room-gate button {
  font-family: inherit;
  font-size: 15px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
}

.room-gate button:hover {
  background: var(--button-hover);
}

.room-error {
  color: var(--text);
  margin-top: 12px;
  display: none;
}

.room-error.visible {
  display: block;
}

.room-content {
  display: none;
}

.room-content.unlocked {
  display: block;
}

.room-gate.hidden {
  display: none;
}

@media (max-width: 600px) {
  .layout {
    flex-direction: column;
    gap: 32px;
    padding: 32px 20px;
  }

  nav {
    width: 100%;
  }

  nav .name {
    margin-bottom: 16px;
  }

  nav ul {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
  }

  nav li {
    margin-bottom: 0;
  }
}
