* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-color);
  font-family: var(--body-font);
  font-size: var(--body-font-size);
  line-height: 1.6;
  background-color: var(--outside-background-color);
  background-image: var(--outside-background-image);
  background-repeat: var(--outside-background-repeat);
  background-size: var(--outside-background-size, auto);
  background-position: var(--outside-background-position, left top);
  background-attachment: var(--outside-background-attachment, scroll);
}

a {
  color: var(--link-color);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { color: var(--link-hover-color); }
img, video, iframe { max-width: 100%; }
img { height: auto; }
button, input, textarea { font: inherit; }

.skip-link {
  position: fixed;
  top: -80px;
  left: 12px;
  z-index: 100;
  padding: 7px 10px;
  color: var(--text-color);
  background: var(--panel-background);
  border: 1px solid var(--border-color);
}
.skip-link:focus { top: 12px; }

.page-shell {
  width: min(var(--page-width), calc(100% - 24px));
  margin: 24px auto;
  background-color: var(--page-background);
  background-image: var(--page-background-image, none);
  background-repeat: var(--page-background-repeat, repeat);
  border: 1px solid var(--border-color);
  box-shadow: var(--panel-shadow);
}

.site-header {
  min-height: var(--header-height);
  display: grid;
  place-items: center;
  position: relative;
  padding: 24px;
  overflow: hidden;
  text-align: center;
  background-color: var(--header-background);
  background-image: var(--custom-header-image, none);
  background-position: var(--header-image-position);
  background-size: var(--header-image-size);
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--border-color);
}

.header-text {
  max-width: 680px;
  padding: 12px 20px;
}

.site-header.has-image .header-text {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.site-header h1 {
  margin: 0;
  color: var(--site-title-color);
  font-family: var(--title-font);
  font-size: clamp(38px, 7vw, var(--site-title-size));
  font-weight: normal;
  line-height: 1;
  text-shadow: var(--site-title-shadow);
}

.site-header .japanese-title {
  display: block;
  margin-top: 7px;
  color: var(--accent-color);
  font-family: var(--small-font);
  font-size: 12px;
  letter-spacing: 0.2em;
}

.site-header p {
  margin: 8px 0 0;
  color: var(--muted-text-color);
  font-size: 13px;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--navigation-background);
  border-bottom: 1px solid var(--border-color);
}

.main-nav a {
  display: block;
  padding: 8px 18px;
  color: var(--text-color);
  border-left: 1px solid var(--soft-border-color);
  font-family: var(--small-font);
  font-size: 12px;
  text-decoration: none;
  text-transform: lowercase;
}

.main-nav a:last-child { border-right: 1px solid var(--soft-border-color); }
.main-nav a:hover,
.main-nav a[aria-current="page"] { color: var(--accent-color); background: var(--panel-background); }

.site-note {
  padding: 4px 12px;
  color: var(--muted-text-color);
  background-color: var(--panel-background);
  background-image: var(--panel-background-image, none);
  background-repeat: var(--panel-background-repeat, repeat);
  border-bottom: 1px dotted var(--soft-border-color);
  font-family: var(--small-font);
  font-size: 10px;
  text-align: center;
}

.content-grid {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
}

.sidebar {
  display: grid;
  gap: 13px;
}

.side-panel,
.welcome-panel,
.page-panel,
.blog-post,
.tag-browser,
.archive-month,
.error-card,
.empty-card,
.loading-card {
  background-color: var(--panel-background);
  background-image: var(--panel-background-image, none);
  background-repeat: var(--panel-background-repeat, repeat);
  border: 1px solid var(--border-color);
  border-radius: var(--corner-radius);
  box-shadow: var(--panel-shadow);
}

.side-panel h2 {
  margin: 0;
  padding: 5px 8px;
  color: var(--accent-color);
  background: var(--navigation-background);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--small-font);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.side-content { padding: 9px 10px; }
.side-content p { margin: 0 0 8px; font-size: 12px; }
.side-content p:last-child { margin-bottom: 0; }

.profile-image {
  display: block;
  width: 100%;
  margin: 0 0 9px;
  border: 1px solid var(--soft-border-color);
}

.status-line {
  padding-top: 7px;
  border-top: 1px dotted var(--soft-border-color);
  color: var(--muted-text-color);
  font-family: var(--small-font);
  font-size: 10px !important;
}

.status-line strong { color: var(--accent-color); }

.link-list,
.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-list li,
.recent-list li {
  padding: 4px 0;
  border-bottom: 1px dotted var(--soft-border-color);
  font-size: 11px;
}

.link-list li:last-child,
.recent-list li:last-child { border-bottom: 0; }
.link-list a { text-decoration: none; }
.recent-list time { display: block; color: var(--muted-text-color); font-family: var(--small-font); font-size: 9px; }

/* REAL MUSIC PLAYER */
.music-player { padding: 9px; }
.track-window {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  padding: 5px 7px;
  background: var(--page-background);
  border: 1px inset var(--soft-border-color);
  font-family: var(--small-font);
  font-size: 10px;
}
.track-window span { display: inline-block; min-width: 100%; }
.track-window span.scrolling { animation: track-scroll 12s linear infinite; will-change: transform; }
@keyframes track-scroll { from { transform: translateX(100%); } to { transform: translateX(-100%); } }

.player-time {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted-text-color);
  font-family: var(--small-font);
  font-size: 9px;
}

.seek-slider,
.volume-slider {
  width: 100%;
  accent-color: var(--accent-color);
}

.seek-slider { margin: 2px 0 6px; }
.volume-slider { height: 14px; }

.player-controls {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}

.player-controls button {
  min-width: 0;
  padding: 4px 2px;
  color: var(--text-color);
  background: var(--navigation-background);
  border: 1px solid var(--border-color);
  border-radius: 0;
  cursor: pointer;
  font-family: var(--small-font);
  font-size: 10px;
}
.player-controls button:hover,
.player-controls button.active { color: var(--accent-color); background: var(--panel-background); }
.player-controls button:disabled { opacity: 0.45; cursor: default; }

.volume-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 5px;
  align-items: center;
  margin-top: 5px;
}
.volume-row button { padding: 0; color: var(--text-color); background: transparent; border: 0; cursor: pointer; }

.main-column {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.welcome-panel,
.page-panel { padding: 20px 22px; }
.welcome-panel h1,
.page-panel h1 { margin: 0 0 7px; color: var(--post-title-color); font-family: var(--title-font); font-size: 28px; font-weight: normal; }
.welcome-panel p,
.page-panel p { margin: 0; }

.section-heading {
  margin: 0;
  padding-bottom: 5px;
  color: var(--accent-color);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--small-font);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-feed,
.archive-list { display: grid; gap: 15px; }

.blog-post { overflow: hidden; }
.post-header { padding: 16px 20px 11px; border-bottom: 1px solid var(--soft-border-color); }
.post-date,
.post-mood { margin: 0; color: var(--muted-text-color); font-family: var(--small-font); font-size: 9px; }
.post-header h1,
.post-header h2 { margin: 3px 0; color: var(--post-title-color); font-family: var(--title-font); font-size: var(--post-title-size); font-weight: normal; line-height: 1.2; }
.post-header h2 a { color: inherit; text-decoration: none; }
.post-header h2 a:hover { color: var(--link-hover-color); }
.post-body { display: flow-root; padding: 16px 20px; overflow-wrap: anywhere; }
.post-body p:first-child { margin-top: 0; }
.post-body p:last-child { margin-bottom: 0; }
.post-body h2 { color: var(--post-title-color); font-family: var(--title-font); font-weight: normal; border-bottom: 1px solid var(--soft-border-color); }
.post-body blockquote { margin: 16px 8px; padding: 7px 12px; border-left: 3px solid var(--second-accent-color); background: var(--navigation-background); }
.post-body img { display: block; margin: 14px auto; border: 1px solid var(--soft-border-color); }
.post-body iframe { display: block; width: 100%; height: auto; aspect-ratio: 16/9; margin: 14px auto; border: 1px solid var(--border-color); }
.post-body .post-break { display: none; }
.post-body .post-image { width: var(--image-width, 55%); max-width: 100%; }
.post-body .post-image.image-size-original { width: max-content; }
.post-body .post-image.image-left { float: left; margin: 6px 16px 10px 0; }
.post-body .post-image.image-center { clear: both; margin: 14px auto; }
.post-body .post-image.image-right { float: right; margin: 6px 0 10px 16px; }
.post-body .post-image img { width: 100%; margin: 0; }
.post-body figure figcaption { margin-top: 4px; color: var(--muted-text-color); font-family: var(--small-font); font-size: 9px; text-align: center; }
.post-body .post-audio { clear: both; margin: 14px auto; text-align: center; }
.post-body .post-audio audio { display: block; width: min(100%, 520px); margin: 5px auto; }
.post-footer { display: flex; justify-content: space-between; gap: 10px; padding: 7px 20px; background: var(--navigation-background); border-top: 1px dotted var(--soft-border-color); font-family: var(--small-font); font-size: 9px; }
.read-more { font-weight: bold; text-decoration: none; }
.memo-box { padding: 9px 12px; background: var(--navigation-background); border: 1px solid var(--soft-border-color); }
.centered { text-align: center; }

.tag-links,
.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-link { display: inline-block; padding: 2px 6px; color: var(--link-color); background: var(--panel-background); border: 1px solid var(--soft-border-color); text-decoration: none; }
.tag-link:hover,
.tag-link.active { color: var(--link-hover-color); background: var(--navigation-background); border-color: var(--border-color); }
.tag-link small { color: var(--muted-text-color); font-size: .9em; }
.no-tags { color: var(--muted-text-color); }

.tag-browser { padding: 13px 16px; }
.tag-browser h2 { margin: 0 0 9px; color: var(--post-title-color); font-family: var(--title-font); font-size: 20px; font-weight: normal; }
.tag-filter-note { margin: 10px 0 0; color: var(--muted-text-color); font-size: 11px; }

.archive-month { padding: 0 18px 12px; }
.archive-month h2 { display: flex; justify-content: space-between; align-items: baseline; margin: 0 -18px 8px; padding: 7px 12px; color: var(--accent-color); background: var(--navigation-background); border-bottom: 1px solid var(--border-color); font-family: var(--title-font); font-size: 19px; font-weight: normal; }
.archive-month h2 small { font-family: var(--small-font); font-size: 9px; }
.archive-month ol { list-style: none; margin: 0; padding: 0; }
.archive-month li { display: grid; grid-template-columns: 60px 1fr; gap: 9px; padding: 7px 0; border-bottom: 1px dotted var(--soft-border-color); }
.archive-month li:last-child { border-bottom: 0; }
.archive-month time { color: var(--muted-text-color); font-family: var(--small-font); font-size: 9px; }
.archive-month li .tag-links { margin-top: 4px; font-family: var(--small-font); font-size: 9px; }

.post-neighbors { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; background: var(--navigation-background); border: 1px solid var(--border-color); font-family: var(--small-font); font-size: 10px; }
.loading-card,
.empty-card,
.error-card { padding: 20px; text-align: center; }
.error-card strong { color: var(--accent-color); }
.about-page h2 { color: var(--post-title-color); font-family: var(--title-font); font-weight: normal; border-bottom: 1px solid var(--soft-border-color); }
.signature { text-align: right; }

.site-footer {
  padding: 12px;
  color: var(--muted-text-color);
  background: var(--navigation-background);
  border-top: 1px solid var(--border-color);
  font-family: var(--small-font);
  font-size: 9px;
  text-align: center;
}
.site-footer p { margin: 1px; }

.error-page { display: grid; place-items: center; padding: 24px; }
.lost-card { width: min(500px, 100%); padding: 35px; text-align: center; }
.big-button { display: inline-block; padding: 7px 10px; background: var(--navigation-background); border: 1px solid var(--border-color); text-decoration: none; }

@media (max-width: 720px) {
  .page-shell { width: min(100% - 12px, 580px); margin: 6px auto; }
  .content-grid { grid-template-columns: 1fr; padding: 12px; }
  .main-column { grid-row: 1; }
  .sidebar { grid-row: 2; grid-template-columns: 1fr 1fr; }
  .music-panel { grid-column: 1 / -1; }
  .site-header { min-height: min(var(--header-height), 180px); }
}

@media (max-width: 430px) {
  .sidebar { grid-template-columns: 1fr; }
  .music-panel { grid-column: auto; }
  .main-nav a { flex: 1 1 50%; text-align: center; border-bottom: 1px solid var(--soft-border-color); }
  .post-footer { flex-direction: column; }
  .post-body .post-image.image-left,
  .post-body .post-image.image-right { float: none; margin: 14px auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .track-window span.scrolling { animation: none; }
}
