:root {
  --page-bg: #ffffff;
  --card-bg: #ffffff;
  --ink: #231f20;
  --accent: #d3683f;
  --accent-dark: #8f3b1f;
  --muted: #6e6562;
  --star-mark-col-width: 1.6rem;
  --star-control-height: 2.6rem;
  --shadow: 0 24px 60px rgba(35, 31, 32, 0.18);
  --pico-background-color: var(--page-bg);
  --pico-card-background-color: var(--page-bg);
}

body {
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  scrollbar-gutter: stable;
  margin: 0;
}

html {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
}

.site-container {
  margin-top: 2.5rem;
  margin-bottom: 15rem;
  max-width: none;
  width: min(900px, calc(100% - 40px));
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 2.5vw, 1.5rem);
  padding-right: clamp(1rem, 2.5vw, 1.5rem);
  box-sizing: border-box;
  background: transparent;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 1.5rem;
  padding: 2.5rem 0 1.5rem;
}

.site-kicker {
  letter-spacing: 0.35em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.site-title {
  margin: 0.2rem 0 0;
  font-family: "SF Pro Display", "SF Pro Text", "Inter", system-ui, sans-serif;
  font-size: clamp(2rem, 2.8vw, 3.4rem);
  line-height: 1.1;
  text-align: center;
}

.site-title-link {
  --pico-color: var(--pico-h2-color);
  display: inline-block;
  color: var(--pico-h2-color);
  white-space: nowrap;
  text-decoration: none;
}

.site-title-link:hover,
.site-title-link:focus-visible,
.site-title-link:active {
  color: var(--pico-h2-color);
  text-decoration: none;
}

.site-title-fixed .site-title-link {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.site-nav a {
  margin-right: 1rem;
  font-weight: 600;
  color: var(--accent-dark);
  text-decoration: none;
}

.site-nav a:last-child {
  margin-right: 0;
}

.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 2.5rem;
  overflow: hidden;
}

.star-form {
  margin-top: 1.5rem;
}

.star-form-row {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
}

.star-form-input,
.star-level-buttons button {
  appearance: none;
  box-sizing: border-box;
  height: var(--star-control-height) !important;
  min-height: var(--star-control-height) !important;
  max-height: var(--star-control-height) !important;
  margin: 0 !important;
  border-width: 1px;
}

.star-form-input {
  display: block;
  padding: 0 0.75rem;
  line-height: calc(var(--star-control-height) - 2px);
  flex: 1 1 auto;
}

.star-form-input:focus::placeholder {
  color: transparent;
}

.star-level-buttons {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.star-level-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.3rem;
  padding: 0 0.55rem;
  font-size: 0.9rem;
  line-height: 1;
  background: transparent;
  border: 1px solid #ddd7d3;
  color: var(--ink);
  transition: background-color 0.15s ease-in-out;
}

.star-level-buttons button[value="2"] {
  font-size: 1.35rem;
}

.star-level-buttons button[value="1"] {
  font-size: 1.35rem;
}

.star-level-buttons button:hover,
.star-level-buttons button:focus-visible {
  background-color: #fff9dc;
}

.form-error {
  margin-top: 0.5rem;
  color: #8f3b1f;
  font-size: 0.9rem;
}

.social-success {
  margin-top: 0.5rem;
  color: #3d6841;
  font-size: 0.9rem;
}

.form-hint {
  margin-top: 0.45rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.burst-message {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-family: "SF Pro Display", "SF Pro Text", "Inter", system-ui, sans-serif;
  font-size: clamp(2rem, 8vw, 4.4rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #F6D556;
  text-shadow: 0 8px 24px rgba(255, 255, 255, 0.85);
  opacity: 0;
  animation: burst-message-fade 4200ms ease-out forwards;
}

@keyframes burst-message-fade {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  15% {
    opacity: 0.96;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.03);
  }
}

.post-card {
  padding: 0;
  border-bottom: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  min-width: 0;
  margin: 0;
}

.social-card {
  margin-top: 1rem;
}

.social-form {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.social-input {
  appearance: none;
  box-sizing: border-box;
  height: var(--star-control-height);
  min-height: var(--star-control-height);
  max-height: var(--star-control-height);
  margin: 0;
  padding: 0 0.75rem;
  line-height: calc(var(--star-control-height) - 2px);
  flex: 1 1 auto;
  min-width: 0;
}

.social-submit {
  appearance: none;
  box-sizing: border-box;
  height: var(--star-control-height);
  min-height: var(--star-control-height);
  max-height: var(--star-control-height);
  margin: 0;
  padding: 0 0.9rem;
  line-height: 1;
  white-space: nowrap;
}

.social-friends-list {
  margin: 1rem 0 0;
  padding-left: 0;
  list-style: none;
}

.social-friend-item {
  margin: 0.35rem 0;
}

.social-friend-details {
  padding: 0;
}

.social-friend-name {
  cursor: pointer;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.12em;
  user-select: none;
}

.social-friend-name::-webkit-details-marker {
  display: none;
}

.social-friend-details[open] .social-friend-name {
  color: var(--accent-dark);
}

.social-star-form {
  margin-top: 0.55rem;
}

.social-empty {
  margin-top: 1rem;
  color: var(--muted);
}

.gift-star-details {
  padding: 0;
}

.gift-star-summary {
  cursor: pointer;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.12em;
  user-select: none;
}

.gift-star-summary::-webkit-details-marker {
  display: none;
}

.gift-star-details[open] .gift-star-summary {
  color: var(--accent-dark);
}

.gift-star-reveal {
  margin-top: 0.4rem;
}

.star-form + .post-card.empty {
  margin-top: 1rem;
}

.post-card-link {
  color: inherit;
  text-decoration: none;
  display: block;
  padding: 0.4rem 0.25rem;
  border-radius: 6px;
  transition: background 0.2s ease-in-out;
}

.post-card-link:hover {
  background: rgba(35, 31, 32, 0.06);
}

.post-row {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  min-height: 2.6em;
}

.star-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.25rem 0;
}

.star-main {
  display: flex;
  align-items: flex-start;
  gap: calc(0.25rem + 0.5em);
  flex: 1 1 auto;
  min-width: 0;
}

.star-level-mark {
  display: inline-flex;
  flex: 0 0 var(--star-mark-col-width);
  width: var(--star-mark-col-width);
  justify-content: center;
  align-items: center;
  text-align: center;
  line-height: 1;
  transform: translateY(0.08em);
}

.star-level-1 {
  font-size: 1.23rem;
  transform: translateY(calc(0em + 0.125rem));
}

.star-level-2 {
  font-size: 1.5rem;
  transform: translateY(calc(0.08em - 0.125rem));
}

.star-level-3 {
  font-size: 1.08rem;
}

.star-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.45;
  flex: 1 1 auto;
}

.star-date {
  color: #a8a3a0;
  font-size: 0.82rem;
  white-space: nowrap;
}

.star-meta-right {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.star-delete-form {
  margin: 0;
}

.star-delete-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #b8b3b0;
  opacity: 0.22;
  font-size: 0.78rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transform: translateY(-0.03em);
}

.star-delete-btn:hover,
.star-delete-btn:focus-visible {
  opacity: 0.72;
  color: #8a7f7b;
}

.post-teaser-img {
  width: 2.6em;
  height: 2.6em;
  flex: 0 0 2.6em;
  overflow: hidden;
  border-radius: 4px;
  display: flex;
}

.post-teaser-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-line {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}

.post-title {
  flex: 0 0 auto;
  font-weight: 600;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-snippet {
  flex: 1 1 auto;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 85%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 85%, transparent 100%);
}

.post-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.post-excerpt {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.post-link {
  color: var(--accent);
  font-weight: 600;
}

.post-detail {
  margin-top: 2.5rem;
  margin-bottom: 3.5rem;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.post-detail h2 {
  font-family: "SF Pro Display", "SF Pro Text", "Inter", system-ui, sans-serif;
}


.post-body {
  margin-top: 2rem;
  line-height: 1.7;
}

.post-body h2,
.post-body h3 {
  margin-top: 2rem;
}

.post-body p img {
  margin-bottom: 2rem;
}


.post-body-priv {
  margin-top: 2.5rem;
  color: #8a7f7b;
  border-top: 1px dashed rgba(35, 31, 32, 0.2);
  padding-top: 1.5rem;
}

.admin-float {
  position: fixed;
  left: 1.5rem;
  bottom: 1.5rem;
  background: var(--page-bg);
  border: 1px solid rgba(35, 31, 32, 0.15);
  padding: 0.75rem 1rem;
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(35, 31, 32, 0.2);
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
}

.admin-float label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--accent-dark);
  font-weight: 600;
}

.post-back a {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 600;
}

.logout-footer {
  text-align: center;
  margin: 8em 0 1rem;
}

.logout-form {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #9e9a97;
  font-size: 0.78rem;
  line-height: 1;
}

.session-user,
.session-sep {
  display: inline-block;
  color: #9e9a97;
  line-height: 1;
  vertical-align: middle;
}

.logout-link {
  display: inline-block;
  color: inherit;
  font-size: inherit;
  font-family: inherit;
  font-weight: inherit;
  line-height: 1;
  text-decoration: none;
}

.logout-link:hover,
.logout-link:focus-visible {
  color: #85807c;
}

@media (max-width: 700px) {
  :root {
    --star-mark-col-width: 1.45rem;
    --star-control-height: 2.35rem;
  }

  .site-container {
    width: calc(100% - 16px);
    margin-top: 1rem;
    margin-bottom: 4rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .site-header {
    padding: 1.2rem 0 1rem;
    gap: 0.75rem;
  }

  .site-title {
    font-size: clamp(1.05rem, 4.8vw, 1.45rem);
  }

  .site-nav a {
    margin-right: 0.65rem;
  }

  .star-level-buttons button {
    min-width: 1.95rem;
    padding: 0 0.45rem;
  }

  .social-form {
    flex-direction: column;
    align-items: stretch;
  }

  .star-text {
    font-size: 1rem;
  }

  .star-date {
    font-size: 0.75rem;
  }
}

@media (max-width: 430px) {
  .star-row {
    gap: 0.4rem;
  }

  .star-meta-right {
    margin-left: auto;
    padding-left: 1.2rem;
  }
}
