/*
 * Hiroe Tech Notes application styles.
 */

:root {
  --paper: #fbf7ee;
  --paper-deep: #f5eee2;
  --ink: #171717;
  --muted: #68645d;
  --line: #ddd1bf;
  --line-soft: rgba(124, 94, 56, 0.16);
  --orange: #f15a24;
  --orange-deep: #e8460a;
  --green: #159447;
  --blue: #1f73d4;
  --shadow: 0 12px 30px rgba(83, 60, 34, 0.12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  --display: "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #e9e9e9;
  font-family: var(--sans);
  letter-spacing: 0;
}

body,
input,
select,
textarea,
button {
  overflow-wrap: anywhere;
}

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

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

.notebook-page {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.8), transparent 30%),
    linear-gradient(rgba(178, 136, 84, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(178, 136, 84, 0.055) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 18px 18px, 18px 18px, auto;
  box-shadow: inset 0 0 80px rgba(134, 105, 65, 0.08);
}

.rings {
  position: absolute;
  left: -4px;
  top: 96px;
  bottom: 22px;
  width: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  pointer-events: none;
  z-index: 4;
}

.rings span {
  width: 29px;
  height: 9px;
  display: block;
  border-radius: 99px;
  background: radial-gradient(circle at 22px 50%, #2b2119 0 4px, transparent 5px), linear-gradient(90deg, #9c846a, #3a2b20);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.site-header {
  height: 80px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 36px;
  padding: 0 48px 0 62px;
  background: rgba(255, 252, 247, 0.78);
  border-bottom: 1px solid var(--line);
}

.brand-link {
  display: flex;
  flex-direction: column;
  width: fit-content;
}

.brand-title {
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-tagline {
  margin-top: 3px;
  color: var(--orange);
  font-weight: 700;
}

.global-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  font-weight: 800;
}

.global-nav a {
  position: relative;
  padding: 30px 0 24px;
}

.global-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  height: 2px;
  background: var(--orange);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.locale-switch {
  min-width: 0;
}

.locale-select {
  min-width: 0;
  max-width: 100%;
}

.icon-button {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #0f1720;
  font-size: 20px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
}

.admin-link {
  color: var(--orange);
  font-weight: 800;
}

.logout-link {
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.search-panel {
  padding: 14px 62px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.78);
}

.search-panel-form {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.search-panel-form input[type="search"] {
  width: min(420px, 100%);
}

.flash-wrap {
  padding: 14px 62px 0;
}

.flash {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,0.72);
}

.flash.alert {
  border-color: #ff9b80;
  color: #b42300;
}

.flash.notice,
.flash[data-flash-kind="notice"] {
  border-color: #2f8f46;
  background-color: #e8f7ed;
  color: #1f6f35;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  min-height: calc(100vh - 132px);
  padding-left: 62px;
}

.content-area {
  padding: 28px 34px 34px 8px;
  min-width: 0;
}

.sidebar {
  border-left: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.48);
}

.sidebar-section {
  padding: 28px 30px;
  border-bottom: 1px solid var(--line);
}

.sidebar-section h2 {
  margin: 0 0 18px;
  padding-bottom: 8px;
  font-size: 16px;
  border-bottom: 1px dashed #bfb6a8;
}

.profile-card h3 {
  margin: 8px 0 2px;
  font-family: var(--display);
  font-size: 24px;
}

.profile-card p {
  line-height: 1.75;
}

.profile-page-card {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 252, 247, 0.54);
}

.profile-page-card h2 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 27px;
}

.profile-links {
  margin-top: 20px;
  flex-wrap: wrap;
}

.role {
  margin: 0 0 10px;
  font-weight: 700;
}

.avatar-drawing {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border: 1px solid #b7b0a7;
  border-radius: 50%;
  background: #fffaf2;
}

.avatar-image,
.settings-avatar-image {
  width: 96px;
  height: 96px;
  display: block;
  border: 1px solid #b7b0a7;
  border-radius: 50%;
  object-fit: cover;
  background: #fffaf2;
}

.avatar-drawing .face {
  width: 64px;
  height: 70px;
  border: 3px solid #111;
  border-left-color: transparent;
  border-radius: 48% 44% 40% 45%;
  position: relative;
}

.avatar-drawing .face::before {
  content: "";
  position: absolute;
  width: 52px;
  height: 32px;
  left: -2px;
  top: -8px;
  border-radius: 60% 50% 40% 40%;
  background: #111;
}

.avatar-drawing .face::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 18px;
  right: -2px;
  bottom: -3px;
  border: 2px solid #111;
  border-top: 0;
  border-radius: 0 0 20px 20px;
}

.social-icons,
.share-icons {
  display: flex;
  align-items: center;
  gap: 18px;
  font-weight: 900;
}

.metric-list,
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.metric-list li a,
.related-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
}

.sidebar-link,
.text-link {
  color: var(--orange);
  font-weight: 800;
}

.sidebar-admin-entry {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.align-right {
  display: block;
  text-align: right;
  margin-top: 14px;
}

.hero-section {
  display: grid;
  grid-template-columns: 1fr 490px;
  gap: 52px;
  min-height: 360px;
  align-items: center;
  padding: 28px 42px 12px 40px;
}

.hero-section > * {
  min-width: 0;
}

.hero-copy h1 {
  margin: 0 0 26px;
  font-family: var(--display);
  font-size: 47px;
  line-height: 1.35;
  font-weight: 900;
  overflow-wrap: normal;
  word-break: keep-all;
}

.hero-copy p {
  max-width: 480px;
  font-size: 16px;
  line-height: 1.9;
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 18px;
}

.check-list li::before {
  content: "✓";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  border-radius: 50%;
  color: #fff;
  background: var(--orange);
  font-size: 12px;
}

.daily-card {
  position: relative;
  max-width: 100%;
  min-width: 0;
  padding: 32px 24px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(250, 246, 236, 0.92);
  box-shadow: var(--shadow);
}

.paperclip {
  position: absolute;
  right: 30px;
  top: -16px;
  width: 21px;
  height: 62px;
  border: 3px solid #333;
  border-left-color: transparent;
  border-radius: 20px;
  transform: rotate(22deg);
}

.section-kicker {
  margin: 0 0 14px;
  font-weight: 800;
}

.daily-card time,
.article-line time,
.experiment-card time {
  color: var(--orange);
  font-weight: 800;
}

.daily-card h2 {
  margin: 8px 0 12px;
  font-size: 16px;
}

.code-card,
.code-block {
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  border-radius: 7px;
  background: radial-gradient(circle at 98% 14px, var(--orange) 0 4px, transparent 5px), #1b1b1b;
  color: #e9e2c9;
  font-family: var(--mono);
  line-height: 1.65;
}

.code-card {
  padding: 16px 20px;
  font-size: 13px;
}

.memo {
  margin: 12px 0 0;
  color: var(--orange);
  font-weight: 800;
}

.daily-link {
  display: block;
  margin-top: 10px;
  color: var(--orange);
  font-weight: 900;
  text-align: right;
}

.note-section {
  padding: 24px 42px 10px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 14px;
}

.section-heading h2,
.page-title-row h1,
.admin-title-row h1,
.single-page h1,
.prose-panel h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
}

.section-heading h2::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 24px;
  margin-right: 12px;
  background: var(--orange);
  vertical-align: -5px;
}

.section-heading h2 span {
  font-size: 15px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.filter-tabs a {
  min-width: 70px;
  padding: 7px 18px;
  border: 1px solid #bdb8af;
  border-radius: 4px;
  background: rgba(255,255,255,0.48);
  text-align: center;
  font-weight: 700;
}

.filter-tabs a.active {
  color: #fff;
  border-color: var(--orange);
  background: var(--orange);
}

.article-lines {
  border-top: 1px solid var(--line);
}

.article-line {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 320px;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
}

.article-line strong,
.experiment-card h3,
.post-list-card h2,
.title-cell strong,
.article-content > h1 {
  overflow-wrap: anywhere;
}

.line-tags {
  min-width: 0;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-preview {
  min-height: 28px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255,255,255,0.5);
  font-size: 12px;
}

.experiment-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
}

.experiment-card,
.post-list-card,
.settings-card,
.stat-card,
.login-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 252, 247, 0.62);
}

.experiment-card {
  min-height: 170px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.experiment-card h3 {
  margin: 8px 0;
  font-size: 17px;
  line-height: 1.45;
}

.experiment-card-preview {
  margin: 8px 0;
  border-radius: 5px;
  overflow: hidden;
}

.experiment-card-image {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 5px;
}

.experiment-card-code {
  margin: 0;
  padding: 12px 16px;
  background: radial-gradient(circle at 98% 14px, var(--orange) 0 4px, transparent 5px), #1b1b1b;
  color: #e9e2c9;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  overflow-x: auto;
  border-radius: 5px;
  height: 140px;
}

.experiment-card-code code {
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

.experiment-card p {
  flex: 1;
  margin: 0;
  line-height: 1.6;
}

.experiment-card footer {
  display: flex;
  gap: 20px;
  margin-top: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  color: #5c626a;
  font-size: 13px;
}

.page-title-row,
.admin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title-row h1,
.admin-title-row h1,
.single-page h1,
.prose-panel h1 {
  position: relative;
  padding-bottom: 12px;
}

.page-title-row h1::after,
.admin-title-row h1::after,
.single-page h1::after,
.prose-panel h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 120px;
  height: 3px;
  background: linear-gradient(90deg, var(--orange), transparent);
}

.search-inline,
.filter-bar {
  display: flex;
  gap: 14px;
}

input,
select,
textarea {
  min-height: 40px;
  border: 1px solid #cfc9bd;
  border-radius: 4px;
  background: rgba(255,255,255,0.58);
  padding: 8px 12px;
}

textarea {
  resize: vertical;
}

.post-list-cards {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.archive-groups {
  display: grid;
  gap: 28px;
}

.archive-group h2 {
  margin: 0 0 12px;
  padding-left: 12px;
  border-left: 5px solid var(--orange);
  font-size: 20px;
}

.archive-group h2 span {
  color: var(--muted);
  font-size: 13px;
}

.post-list-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 16px;
  padding: 18px;
}

.document-icon {
  font-size: 25px;
}

.post-meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.post-list-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.article-content {
  max-width: 980px;
}

.article-label {
  display: inline-flex;
  padding: 5px 10px;
  border: 1px solid var(--orange);
  border-radius: 4px;
  color: var(--orange);
  font-weight: 800;
}

.article-content > h1 {
  margin: 8px 0 12px;
  font-size: 31px;
  line-height: 1.4;
}

.article-admin-actions {
  margin: -4px 0 14px;
}

.admin-edit-link {
  color: var(--orange);
  font-size: 13px;
  font-weight: 800;
}

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

.views-count {
  color: var(--muted);
  font-size: 13px;
}

.article-actions {
  margin-bottom: 16px;
}

.share-x-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255,255,255,0.65);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.share-x-button:hover {
  border-color: var(--orange);
  background: rgba(241, 90, 36, 0.08);
}

.share-x-button .x-icon {
  font-size: 18px;
  line-height: 1;
}

.audio-player-wrapper {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  margin-left: 8px;
}

.audio-player-toggle-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--orange);
  border-radius: 5px;
  background: rgba(241, 90, 36, 0.06);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  color: var(--orange);
  font-family: var(--sans);
  line-height: 1;
}

.audio-player-toggle-button:hover {
  background: rgba(241, 90, 36, 0.12);
}

.audio-player-toggle-icon {
  font-size: 15px;
  line-height: 1;
}

.audio-player-panel {
  padding: 12px 16px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  min-width: 240px;
}

.audio-player-panel:not([hidden]) {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  margin-top: 0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  animation: audio-player-slide-up 0.25s ease-out;
}

@media (max-width: 640px) {
  .audio-player-panel:not([hidden]) {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    animation: audio-player-fade-in 0.25s ease-out;
  }
}

@keyframes audio-player-slide-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes audio-player-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.audio-player-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.audio-player-onair {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}

.audio-player-onair-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bbb;
  transition: background 0.3s, box-shadow 0.3s;
}

.audio-player-onair-dot.active {
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange);
}

.audio-player-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.audio-player-close:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.audio-player-dial-area {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.audio-player-dial {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--paper-deep);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
}

.audio-player-dial:hover {
  border-color: var(--orange);
  background: rgba(241, 90, 36, 0.06);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 0 0 3px rgba(241, 90, 36, 0.1);
}

.audio-player-progress-area {
  margin-bottom: 6px;
}

.audio-player-progress {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line-soft);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

.audio-player-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid var(--paper);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.1s;
}

.audio-player-progress::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.audio-player-progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid var(--paper);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
}

.audio-player-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  margin-top: 3px;
}

.audio-player-radio-label {
  text-align: right;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--line);
  text-transform: uppercase;
  line-height: 1;
}

.audio-player-error {
  font-size: 12px;
  color: #c00;
  margin-top: 6px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
  cursor: pointer;
}

.article-excerpt {
  line-height: 1.8;
}

.markdown-body {
  margin-top: 22px;
  font-size: 15px;
  line-height: 1.75;
}

.markdown-body h2 {
  margin: 24px 0 8px;
  padding-left: 12px;
  border-left: 5px solid var(--orange);
  font-size: 18px;
}

.markdown-body h3 {
  margin: 20px 0 8px;
  font-size: 17px;
}

.markdown-body ul {
  margin-top: 8px;
}

.markdown-body a {
  color: #1a57a8;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.task-list-item {
  list-style: none;
  margin-left: -22px;
}

.task-list-item input {
  min-height: 0;
  margin-right: 8px;
  accent-color: var(--orange);
}

.markdown-table {
  width: min(680px, 100%);
  margin: 16px 0;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: rgba(255,255,255,0.42);
}

.markdown-table th,
.markdown-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.markdown-table th {
  background: rgba(241, 90, 36, 0.08);
  font-weight: 900;
}

.markdown-table tr:last-child td {
  border-bottom: 0;
}

.note-box {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid #ff9b70;
  border-radius: 6px;
  background: rgba(255, 111, 45, 0.08);
}

.article-diagram {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 680px;
  margin: 10px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,0.55);
}

.article-image {
  max-width: 680px;
  margin: 16px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,0.5);
}

.article-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.article-image-viewer-trigger {
  cursor: zoom-in;
}

.article-image-viewer-trigger:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 4px;
}

.article-image figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.image-lightbox-open {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 12, 12, 0.88);
  cursor: zoom-out;
}

.image-lightbox-frame {
  position: relative;
  display: grid;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  cursor: default;
}

.image-lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.image-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: 50%;
  background: rgba(0,0,0,0.72);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.diagram-node {
  min-width: 120px;
  text-align: center;
  font-weight: 800;
}

.diagram-node::before {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 6px;
  border-radius: 10px;
}

.terraform::before { background: #6f4edc; }
.s3::before { background: #34b44a; border-radius: 50% 50% 10px 10px; }
.dynamodb::before { background: #4067df; }

.diagram-arrow {
  flex: 1;
  min-width: 90px;
  text-align: center;
  border-top: 2px solid #111;
  padding-top: 4px;
  font-size: 12px;
}

pre[data-filename] {
  padding-top: 36px;
  position: relative;
}

pre[data-filename]::before {
  content: attr(data-filename);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 6px 18px;
  font-size: 12px;
  font-family: var(--mono);
  color: #a8a29e;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px 7px 0 0;
}

.code-block {
  max-width: 680px;
  padding: 14px 18px;
  white-space: pre-wrap;
}

.code-card.highlight code,
.code-block.highlight code {
  color: #d4d4d4;
}

.code-card .c,
.code-block .c,
.code-card .cm,
.code-block .cm,
.code-card .cp,
.code-block .cp,
.code-card .c1,
.code-block .c1,
.code-card .cs,
.code-block .cs {
  color: #6a9955;
  font-style: italic;
}

.code-card .k,
.code-block .k,
.code-card .kc,
.code-block .kc,
.code-card .kd,
.code-block .kd,
.code-card .kn,
.code-block .kn,
.code-card .kp,
.code-block .kp,
.code-card .kr,
.code-block .kr,
.code-card .kt,
.code-block .kt {
  color: #c586c0;
  font-weight: 700;
}

.code-card .s,
.code-block .s,
.code-card .sa,
.code-block .sa,
.code-card .sb,
.code-block .sb,
.code-card .sc,
.code-block .sc,
.code-card .dl,
.code-block .dl,
.code-card .sd,
.code-block .sd,
.code-card .s2,
.code-block .s2,
.code-card .se,
.code-block .se,
.code-card .sh,
.code-block .sh,
.code-card .si,
.code-block .si,
.code-card .sx,
.code-block .sx,
.code-card .sr,
.code-block .sr,
.code-card .s1,
.code-block .s1,
.code-card .ss,
.code-block .ss {
  color: #ce9178;
}

.code-card .m,
.code-block .m,
.code-card .mb,
.code-block .mb,
.code-card .mf,
.code-block .mf,
.code-card .mh,
.code-block .mh,
.code-card .mi,
.code-block .mi,
.code-card .mo,
.code-block .mo,
.code-card .il,
.code-block .il {
  color: #b5cea8;
}

.code-card .n,
.code-block .n,
.code-card .nb,
.code-block .nb,
.code-card .bp,
.code-block .bp,
.code-card .nc,
.code-block .nc,
.code-card .no,
.code-block .no,
.code-card .nd,
.code-block .nd,
.code-card .ni,
.code-block .ni,
.code-card .ne,
.code-block .ne,
.code-card .nf,
.code-block .nf,
.code-card .fm,
.code-block .fm,
.code-card .nl,
.code-block .nl,
.code-card .nn,
.code-block .nn,
.code-card .nx,
.code-block .nx,
.code-card .py,
.code-block .py,
.code-card .nt,
.code-block .nt,
.code-card .nv,
.code-block .nv,
.code-card .vc,
.code-block .vc,
.code-card .vg,
.code-block .vg,
.code-card .vi,
.code-block .vi,
.code-card .vm,
.code-block .vm {
  color: #d4d4d4;
}

.code-card .na,
.code-block .na,
.code-card .nt,
.code-block .nt {
  color: #9cdcfe;
}

.code-card .nc,
.code-block .nc,
.code-card .no,
.code-block .no,
.code-card .ne,
.code-block .ne,
.code-card .nn,
.code-block .nn {
  color: #4ec9b0;
}

.code-card .nf,
.code-block .nf,
.code-card .fm,
.code-block .fm {
  color: #dcdcaa;
}

.code-card .o,
.code-block .o,
.code-card .ow,
.code-block .ow,
.code-card .p,
.code-block .p {
  color: #d4d4d4;
}

.code-card .err,
.code-block .err,
.code-card .gr,
.code-block .gr,
.code-card .gt,
.code-block .gt {
  color: #ff7b72;
}

.article-footer {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
}

/* Comments section */
.comments-section {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.comments-section > .section-heading {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 18px;
}

.comments-section > .section-heading span {
  font-size: 20px;
  font-weight: 900;
  padding-left: 12px;
  border-left: 5px solid var(--orange);
}

.comment-list {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.comment-item {
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 252, 247, 0.48);
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.comment-author {
  font-weight: 800;
}

.comment-date {
  color: var(--muted);
}

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

.comment-form-wrap {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 252, 247, 0.52);
}

.comment-form-fields {
  display: grid;
  gap: 14px;
}

.comment-form-fields label {
  font-weight: 800;
  font-size: 13px;
}

.comment-form-fields input[type="text"] {
  width: min(360px, 100%);
}

.comment-form-fields textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
}

.turnstile-wrap {
  margin-top: 16px;
  min-height: 72px;
}

.comment-submit-row {
  margin-top: 16px;
}

.admin-page,
.editor-page,
.settings-page,
.single-page {
  padding: 28px 54px 46px 62px;
}

.primary-button,
.secondary-button,
.small-button,
.danger-button,
.outline-danger,
.filter-bar input[type="submit"],
.search-inline input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255,255,255,0.65);
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  border-color: var(--orange);
  background: linear-gradient(135deg, var(--orange), var(--orange-deep));
}

.secondary-button {
  color: #111;
}

.small-button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.danger-button,
.outline-danger {
  min-height: 32px;
  color: #ff3b1f;
  border-color: #ff8b76;
  background: rgba(255,255,255,0.72);
}

.button-with-badge {
  position: relative;
  display: inline-flex;
}

.badge-dot {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  background: #e53e3e;
  border: 3px solid #fff;
  border-radius: 50%;
  pointer-events: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 28px;
}

.stat-card strong {
  display: block;
  font-size: 16px;
}

.stat-card small {
  display: block;
  color: var(--muted);
}

.stat-icon {
  font-size: 30px;
}

.status-dot {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: inline-block;
  box-shadow: inset 0 0 0 7px rgba(255,255,255,0.72);
}

.status-dot.published { background: var(--green); }
.status-dot.draft { background: #ff9b18; }
.status-dot.reviewing { background: var(--blue); }

.filter-bar {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,252,247,0.55);
}

.filter-bar input[type="search"] {
  flex: 1;
  min-width: 230px;
}

.filter-bar select {
  min-width: 210px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,252,247,0.52);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  font-size: 13px;
}

.title-cell {
  display: flex;
  gap: 12px;
  min-width: 430px;
}

.title-cell small {
  display: block;
  max-width: 500px;
  margin-top: 5px;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
}

.status-badge.published {
  color: #087737;
  border: 1px solid #acd8bc;
  background: #e9f7ee;
}

.status-badge.draft {
  color: #be5a00;
  border: 1px solid #ffd39b;
  background: #fff3df;
}

.status-badge.reviewing {
  color: #145db2;
  border: 1px solid #acd0ff;
  background: #e9f3ff;
}

.action-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.action-cell form {
  display: inline;
}

.views-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 8px;
}

.pagination span,
.pagination strong,
.pagination a {
  min-width: 46px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255,255,255,0.62);
}

.pagination strong {
  color: #fff;
  border-color: var(--orange);
  background: var(--orange);
}

.page-count,
.last-updated {
  text-align: center;
  color: var(--muted);
}

.editor-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
}

.editor-title-field {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

.editor-title-field span {
  font-size: 13px;
}

.editor-title-field b {
  color: var(--orange);
}

.editor-title-field em {
  justify-self: end;
  margin-top: -34px;
  padding-right: 12px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  pointer-events: none;
}

.editor-actions {
  display: flex;
  gap: 16px;
  align-items: end;
  padding-bottom: 1px;
}

.editor-views-count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.publish-menu {
  position: relative;
}

.publish-menu summary {
  list-style: none;
}

.publish-menu summary::-webkit-details-marker {
  display: none;
}

.publish-menu-panel {
  position: absolute;
  right: 0;
  top: 48px;
  z-index: 10;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.publish-menu-item {
  width: 100%;
  min-height: 34px;
  display: block;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 7px 10px;
  cursor: pointer;
}

.publish-menu-item:hover {
  background: rgba(241, 90, 36, 0.1);
}

.publish-menu-item:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.editor-fields {
  display: grid;
  grid-template-columns: 1fr 0.55fr 0.55fr;
  gap: 14px;
  margin-top: 16px;
}

.editor-fields label,
.settings-fields label,
.login-form label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

.editor-fields label span,
.settings-fields label span,
.login-form label span {
  font-size: 13px;
}

.editor-fields b {
  color: var(--orange);
}

.editor-fields em {
  padding-right: 12px;
  color: var(--muted);
  text-align: right;
  font-style: normal;
  font-size: 12px;
  pointer-events: none;
}

.editor-fields textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  overflow-wrap: anywhere;
}

.ai-summary-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.ai-icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 252, 247, 0.78);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.ai-icon-button:hover,
.ai-icon-button:focus-visible {
  border-color: var(--orange);
  background: rgba(241, 90, 36, 0.1);
  outline: none;
}

.ai-icon-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.ai-icon-button::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  max-width: min(280px, 70vw);
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-deep);
  box-shadow: 0 8px 20px rgba(33, 28, 22, 0.16);
  color: var(--ink);
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  white-space: normal;
}

.ai-icon-button:hover::after,
.ai-icon-button:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ai-summary-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.ai-summary-message.error {
  color: #b42300;
}

.span-3,
.settings-fields .wide {
  grid-column: span 3;
}

.markdown-editor {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,252,247,0.58);
}

.editor-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.editor-tabs button {
  min-width: 96px;
  height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  font-weight: 800;
}

.editor-tabs button.active {
  color: var(--orange);
  border-bottom: 2px solid var(--orange);
}

.editor-tabs a {
  margin-left: auto;
  margin-right: 14px;
  color: #1a57a8;
  font-size: 13px;
  font-weight: 800;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
}

.toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255,255,255,0.72);
  line-height: 1;
  overflow-wrap: normal;
  white-space: nowrap;
}

.post-image-uploader {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.36);
}

.post-image-uploader label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  min-width: 0;
  white-space: nowrap;
}

.post-image-uploader span,
.post-image-uploader p {
  font-size: 13px;
}

.post-image-uploader input {
  width: 280px;
  max-width: min(280px, 100%);
  overflow-wrap: normal;
}

.post-image-uploader p {
  margin: 0;
  color: var(--muted);
}

.textarea-shell {
  display: grid;
  grid-template-columns: 42px 1fr;
  height: 580px;
  overflow: hidden;
}

.textarea-shell.preview-mode {
  grid-template-columns: 1fr;
}

.textarea-shell.preview-mode .line-numbers {
  display: none;
}

.line-numbers {
  padding: 9px 8px;
  border-right: 1px solid var(--line);
  color: #8c8c8c;
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
  background: rgba(255,255,255,0.4);
  overflow: hidden;
  user-select: none;
}

.line-numbers span {
  display: block;
  line-height: 1.55;
}

.textarea-shell textarea {
  height: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  outline: 0;
  resize: none;
  overflow-y: auto;
}

.markdown-preview {
  grid-column: 2;
  height: 100%;
  padding: 18px 22px;
  line-height: 1.75;
  overflow-y: auto;
}

.textarea-shell.preview-mode .markdown-preview {
  grid-column: 1;
}

.markdown-preview h1,
.markdown-preview h2 {
  color: #18458f;
}

.markdown-preview pre {
  padding: 14px;
  border-radius: 6px;
  background: #1b1b1b;
  color: #e9e2c9;
  overflow: auto;
}

.editor-footer {
  display: flex;
  gap: 24px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.editor-footer a {
  margin-left: auto;
  color: #1a57a8;
  font-weight: 800;
}

.post-image-list {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,252,247,0.58);
}

.post-image-list-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
  margin-bottom: 14px;
}

.post-image-list-header h2,
.post-image-list-header p {
  margin: 0;
}

.post-image-list-header h2 {
  font-size: 18px;
}

.post-image-list-header p,
.empty-note {
  color: var(--muted);
  font-size: 13px;
}

.post-image-grid {
  display: grid;
  gap: 12px;
}

.post-image-item {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255,255,255,0.5);
}

.post-image-thumb {
  width: 110px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.post-image-item strong,
.post-image-item small,
.post-image-item code,
.post-image-item em {
  display: block;
}

.post-image-item small,
.post-image-item em {
  color: var(--muted);
}

.post-image-item code {
  max-width: 100%;
  margin-top: 4px;
  color: #1a57a8;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.post-image-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.login-header {
  grid-template-columns: 1fr auto;
}

.login-page-main {
  min-height: calc(100vh - 132px);
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 64px 20px;
}

.login-illustration {
  position: relative;
  width: 300px;
  height: 120px;
}

.terminal-doodle,
.notebook-doodle,
.pencil-doodle {
  position: absolute;
  display: block;
  border: 2px solid #222;
  background: #fffaf2;
  box-shadow: 0 4px 0 rgba(0,0,0,0.08);
}

.terminal-doodle {
  left: 10px;
  top: 42px;
  width: 80px;
  height: 58px;
  padding: 20px 12px 10px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 12px 8px, #ff5f57 0 3px, transparent 4px),
    radial-gradient(circle at 23px 8px, #ffbd2e 0 3px, transparent 4px),
    radial-gradient(circle at 34px 8px, #28c840 0 3px, transparent 4px),
    linear-gradient(#f4eadb 0 15px, #2a2a2a 15px);
  color: #fff;
  font-family: var(--mono);
  transform: rotate(-8deg);
}

.notebook-doodle {
  left: 100px;
  top: 12px;
  width: 110px;
  height: 94px;
  border-radius: 8px;
  transform: rotate(-8deg);
}

.notebook-doodle::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 12px;
  width: 14px;
  height: 68px;
  background: repeating-radial-gradient(circle at 50% 6px, #333 0 2px, transparent 3px 12px);
}

.notebook-doodle::after {
  content: "";
  position: absolute;
  inset: 18px 12px;
  background:
    linear-gradient(90deg, transparent 0 12px, #ffb3a0 12px 14px, transparent 14px),
    repeating-linear-gradient(#d7c6ac 0 1px, transparent 1px 13px);
  border-left: 2px solid #ff9b80;
}

.pencil-doodle {
  right: 50px;
  top: 30px;
  width: 16px;
  height: 90px;
  border-radius: 8px;
  background:
    linear-gradient(#f7d6a1 0 8px, #ffad3b 8px 68px, #f7f0d5 68px 78px, #222 78px);
  transform: rotate(24deg);
}

.leaf-doodle {
  position: absolute;
  right: 5px;
  bottom: 14px;
  font-size: 50px;
  color: #6b5f4a;
}

.login-card {
  width: min(530px, calc(100vw - 40px));
  padding: 48px 54px 58px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 18px;
  padding-left: 30px;
  border-left: 1px solid #ffc4ad;
  font-size: 29px;
}

.login-card p {
  margin-bottom: 30px;
}

.login-form {
  display: grid;
  gap: 22px;
}

.password-field {
  position: relative;
}

.password-field input {
  width: 100%;
  padding-right: 48px;
}

.password-field button {
  position: absolute;
  top: 0;
  right: 6px;
  width: 38px;
  height: 40px;
  border: 0;
  background: transparent;
}

.login-options {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-weight: 800;
}

.login-options a {
  color: #176ddc;
}

.wide {
  width: 100%;
}

.admin-note {
  margin-top: 26px;
  font-weight: 800;
}

.settings-page .admin-title-row {
  margin-bottom: 26px;
}

.title-actions {
  display: flex;
  gap: 20px;
}

.settings-card {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 30px;
  padding: 22px 26px;
  margin-bottom: 12px;
}

.settings-card-title {
  display: grid;
  grid-template-columns: 42px 1fr;
  column-gap: 12px;
  align-content: start;
}

.settings-card-title > span {
  grid-row: span 2;
  color: var(--orange);
  font-size: 28px;
}

.settings-card-title h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.settings-card-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.settings-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 24px;
  align-items: end;
}

.upload-placeholder {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 1px dashed #bfa58f;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
}

.upload-placeholder input,
.settings-avatar-upload input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.settings-thumb {
  max-width: 180px;
  max-height: 80px;
  border-radius: 4px;
  object-fit: cover;
}

.settings-avatar-upload {
  cursor: pointer;
}

.file-label {
  cursor: pointer;
}

.settings-save-notice {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  color: var(--orange);
  font-size: 13px;
  font-weight: 800;
}

.settings-avatar {
  width: 100px;
  height: 100px;
}

.settings-card.compact {
  align-items: center;
}

.toggle-label {
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  gap: 10px;
}

.toggle-label input {
  appearance: none;
  width: 38px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: var(--orange);
}

.toggle-label input::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 2px 2px 2px auto;
  border-radius: 50%;
  background: #fff;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.tag-pill {
  display: inline-flex;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,0.55);
}

.category-pill span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.prose-panel {
  max-width: 780px;
  line-height: 1.9;
}

.error-box {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #ff9b80;
  border-radius: 6px;
  color: #b42300;
  background: rgba(255,120,90,0.08);
}

.theme-dark {
  --paper: #211f1c;
  --paper-deep: #28231f;
  --ink: #f4eee4;
  --muted: #c5b9a6;
  --line: #5b4d3e;
  --line-soft: rgba(255, 236, 210, 0.12);
}

.theme-dark body {
  background: #111;
}

.theme-dark .notebook-page {
  background:
    linear-gradient(rgba(255, 236, 210, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 236, 210, 0.055) 1px, transparent 1px),
    var(--paper);
  background-size: 18px 18px, 18px 18px, auto;
}

.theme-dark .audio-player-panel {
  background: rgba(39, 35, 30, 0.78);
}

.theme-dark .audio-player-dial {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
}

.theme-dark .audio-player-dial:hover {
  background: rgba(241, 90, 36, 0.1);
}

.theme-dark .audio-player-progress {
  background: rgba(255, 236, 210, 0.12);
}

.theme-dark input,
.theme-dark select,
.theme-dark textarea,
.theme-dark .daily-card,
.theme-dark .experiment-card,
.theme-dark .post-list-card,
.theme-dark .settings-card,
.theme-dark .stat-card,
.theme-dark .login-card,
.theme-dark .admin-table-wrap,
.theme-dark .filter-bar {
  color: var(--ink);
  background: rgba(39, 35, 30, 0.78);
}

@media (max-width: 1050px) {
  .site-header {
    grid-template-columns: 1fr auto;
    height: auto;
    padding: 18px 28px 18px 48px;
  }

  .global-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
  }

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

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

  .hero-section,
  .stat-grid,
  .settings-card,
  .settings-fields,
  .editor-title-row,
  .editor-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .experiment-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .span-3,
  .settings-fields .wide {
    grid-column: auto;
  }

  .editor-actions {
    flex-wrap: wrap;
    margin-bottom: 0;
  }

  .article-line {
    grid-template-columns: 1fr;
    padding: 10px 0;
  }
}

@media (min-width: 1051px) and (max-width: 1300px) {
  .hero-section {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 42%);
    gap: 28px;
  }

  .hero-copy h1 {
    font-size: 42px;
  }
}

@media (max-width: 720px) {
  .notebook-page {
    min-height: 100vh;
  }

  .site-header,
  .content-area,
  .admin-page,
  .editor-page,
  .settings-page,
  .single-page {
    padding-left: 18px;
    padding-right: 18px;
  }

  .page-grid {
    padding-left: 42px;
    padding-right: 18px;
  }

  .brand-title {
    font-size: 21px;
  }

  .hero-copy h1 {
    font-size: 34px;
  }

  .filter-bar,
  .search-inline,
  .login-options,
  .title-actions {
    flex-direction: column;
  }

  .filter-bar input,
  .filter-bar select,
  .filter-bar .secondary-button,
  .filter-bar input[type="submit"],
  .search-inline input {
    width: 100%;
    min-width: 0;
  }

  .admin-table th,
  .admin-table td {
    padding: 12px;
  }

  .login-card {
    padding: 32px 24px;
  }

  .image-lightbox {
    padding: 12px;
  }

  .image-lightbox-frame,
  .image-lightbox-image {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }
}

/* ========== Mobile responsive additions ========== */

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #0f1720;
  font-size: 22px;
  cursor: pointer;
  line-height: 36px;
  text-align: center;
}

@media (max-width: 853px) {
  .menu-toggle {
    display: inline-block;
    width: 44px;
    height: 44px;
    font-size: 24px;
    line-height: 44px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
    font-size: 22px;
    line-height: 44px;
  }

  .global-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding: 0 0 14px;
  }

  .global-nav[data-menu-open] {
    display: flex;
  }

  .global-nav a {
    padding: 12px 0;
  }

  .global-nav a.active::after {
    bottom: 6px;
  }

  .site-header {
    padding-left: 42px;
    padding-right: 18px;
  }

  .search-panel {
    padding-left: 42px;
    padding-right: 18px;
  }

  .breadcrumbs {
    font-size: 12px;
    gap: 8px;
    margin-bottom: 16px;
  }

  .post-list-card {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px;
  }

  .post-list-card h2 {
    font-size: 17px;
  }

  .experiment-cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .experiment-card {
    min-height: auto;
  }

  .article-lines {
    border-top: none;
  }

  .hero-section {
    padding: 18px 0 0;
    gap: 24px;
  }

  .daily-card {
    padding: 24px 18px 18px;
  }

  .note-section {
    padding: 18px 0;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .filter-tabs {
    gap: 10px;
  }

  .filter-tabs a {
    min-width: 0;
    min-height: 44px;
    padding: 6px 14px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
  }

  .page-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .page-title-row .search-inline {
    width: 100%;
  }

  .search-inline {
    flex-wrap: wrap;
  }

  .search-inline input[type="search"] {
    width: 100%;
    min-width: 0;
  }

  .search-inline input[type="submit"],
  .search-inline .secondary-button {
    flex: 1;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination span,
  .pagination strong,
  .pagination a {
    min-width: 40px;
    height: 38px;
    font-size: 13px;
  }

  .tag-cloud {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .tag-pill {
    display: flex;
    justify-content: space-between;
    min-height: 44px;
  }

  .content-area {
    padding: 18px 0 18px 0;
  }

  .article-content > h1 {
    font-size: 24px;
  }

  .article-meta {
    font-size: 13px;
    gap: 8px;
  }

  .profile-page-card {
    flex-direction: column;
    text-align: center;
    padding: 14px;
  }

  .prose-panel {
    max-width: 100%;
  }

  .single-page {
    padding: 18px 0;
  }

  .single-page h1 {
    font-size: 24px;
  }

  .mobile-toc-box {
    margin: 18px 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 252, 247, 0.6);
  }

  .mobile-toc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 800;
    user-select: none;
  }

  .mobile-toc-header .toc-toggle-icon {
    margin-left: auto;
    transition: transform 0.2s;
  }

  .mobile-toc-header[aria-expanded="true"] .toc-toggle-icon {
    transform: rotate(180deg);
  }

  .mobile-toc-body {
    padding: 0 14px 12px;
  }

  .mobile-toc-body[hidden] {
    display: none;
  }

  .mobile-toc-body ol {
    margin: 0;
    padding-left: 20px;
  }

  .mobile-toc-body li {
    padding: 4px 0;
    font-size: 14px;
  }

  .mobile-related-posts {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }

  .mobile-related-posts h3 {
    margin: 0 0 12px;
    font-size: 16px;
    padding-left: 12px;
    border-left: 4px solid var(--orange);
  }

  .mobile-related-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 14px;
  }

  .mobile-share {
    margin-top: 18px;
    display: flex;
    gap: 14px;
    align-items: center;
  }

  .mobile-share a {
    font-weight: 900;
    color: var(--orange);
  }

  .chip {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .tag-cloud {
    grid-template-columns: 1fr;
  }

  .rings span {
    width: 22px;
    height: 7px;
  }

  .page-grid {
    padding-left: 36px;
    padding-right: 14px;
  }

  .site-header {
    gap: 12px;
    padding-left: 36px;
    padding-right: 14px;
  }

  .menu-toggle {
    width: 36px;
    height: 36px;
    font-size: 20px;
    line-height: 36px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
    font-size: 18px;
    line-height: 36px;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding-left: 42px;
    padding-right: 18px;
    gap: 18px;
  }

  .brand-title {
    font-size: 21px;
  }

  .brand-tagline {
    font-size: 12px;
    white-space: nowrap;
  }

  .hero-copy h1 {
    font-size: 34px;
  }

  .filter-bar,
  .login-options,
  .title-actions {
    flex-direction: column;
  }

  .filter-bar input,
  .filter-bar select,
  .filter-bar .secondary-button,
  .filter-bar input[type="submit"],
  .search-inline input {
    width: 100%;
    min-width: 0;
  }

  .admin-table th,
  .admin-table td {
    padding: 12px;
  }

  .login-card {
    padding: 32px 24px;
  }

  .image-lightbox {
    padding: 12px;
  }

  .image-lightbox-frame,
  .image-lightbox-image {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }
}

@media (min-width: 854px) {
  .mobile-only {
    display: none !important;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.publish-modal-card {
  background: #fdfaf5;
  border: 1px solid var(--line, #e2d9cd);
  border-radius: 12px;
  width: 92%;
  max-width: 860px;
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line, #e2d9cd);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text, #333);
}

.modal-header .close-button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #888;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-header .close-button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #333;
}

.modal-body {
  flex: 1;
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
}

.publish-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.publish-modal-left,
.publish-modal-right {
  display: grid;
  gap: 16px;
  align-content: start;
}

.publish-field {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

.publish-field b {
  color: var(--orange);
}

.publish-field em {
  padding-right: 12px;
  color: var(--muted);
  text-align: right;
  font-style: normal;
  font-size: 12px;
  pointer-events: none;
}

.publish-field textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  overflow-wrap: anywhere;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.publish-checkbox {
  margin-top: 0;
}

@media (max-width: 760px) {
  .publish-modal-grid {
    grid-template-columns: 1fr;
  }
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line, #e2d9cd);
  background: rgba(0, 0, 0, 0.02);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.theme-dark .publish-modal-card {
  background: var(--paper);
}

.theme-dark .modal-header h2,
.theme-dark .modal-header .close-button {
  color: var(--ink);
}

.theme-dark .modal-header .close-button:hover,
.theme-dark .modal-footer {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.theme-dark .ai-icon-button {
  background: var(--paper-deep);
}

@media (max-width: 760px) {
  .modal-backdrop {
    padding: 12px;
  }

  .publish-modal-card {
    width: 100%;
    max-height: calc(100dvh - 24px);
  }

  .modal-header,
  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 16px;
  }

  .modal-footer .secondary-button,
  .modal-footer .primary-button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
}

.api-key-issue-form {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  gap: 14px 24px;
  align-items: end;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,252,247,0.52);
}

.api-key-issue-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

.api-key-issue-form input,
.api-key-issue-form select {
  width: 100%;
}

.api-key-table {
  min-width: 760px;
}

.api-key-empty {
  margin: 0;
  color: var(--muted);
}

.api-key-prefix {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255,252,247,0.6);
  font-family: var(--mono);
  font-size: 13px;
  white-space: nowrap;
}

.status-badge.api-key-active {
  color: #087737;
  border: 1px solid #acd8bc;
  background: #e9f7ee;
  white-space: nowrap;
}

.status-badge.api-key-revoked {
  color: var(--muted);
  border: 1px solid var(--line);
  background: transparent;
  white-space: nowrap;
}

.api-key-table td form {
  display: inline;
}

.api-key-table td button {
  white-space: nowrap;
}

.api-key-created {
  display: grid;
  gap: 16px;
  justify-items: start;
}

.api-key-warning {
  margin: 0;
  padding: 12px;
  border: 1px solid #ff9b80;
  border-radius: 6px;
  color: #b42300;
  background: rgba(255,120,90,0.08);
  font-weight: 800;
}

.api-key-plain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.api-key-token {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,252,247,0.6);
  font-family: var(--mono);
  word-break: break-all;
}

.api-key-note {
  margin: 0;
  color: var(--muted);
}

.theme-dark .api-key-issue-form,
.theme-dark .api-key-prefix,
.theme-dark .api-key-token {
  color: var(--ink);
  background: rgba(39, 35, 30, 0.78);
}

@media (max-width: 1050px) {
  .api-key-issue-form {
    grid-template-columns: minmax(0, 1fr);
  }
}
