button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
}

.guestbook-page {
  position: relative;
  z-index: 1;
  width: min(100%, 1320px);
  margin: 0 auto;
}

.guestbook-header,
.guestbook-layout {
  width: 100%;
}

.guestbook-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
}

.guestbook-heading {
  min-width: 0;
}

.section-intro {
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.6;
}

.guestbook-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  align-items: start;
  column-gap: 0.8rem;
  row-gap: 0.68rem;
}

.guestbook-card {
  min-width: 0;
  padding: 0.7rem;
}

.wall-card {
  display: flex;
  flex-direction: column;
  max-height: 754px;
  min-height: 0;
  overflow: hidden;
}

.compose-card {
  position: sticky;
  top: 1rem;
}

.guestbook-card h2 {
  color: var(--text-soft);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.compose-card .section-intro {
  margin: 0.4rem 0 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-bottom: 0.8rem;
}

.form-field label span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.form-field input,
.form-field textarea {
  width: 100%;
  resize: vertical;
}

.form-field textarea {
  min-height: 8rem;
  line-height: 1.6;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.char-count {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.load-more {
  width: 100%;
  border: 0;
  border-top: 1px dotted var(--border);
  border-radius: 0;
  padding: 0.55rem 0 0.25rem;
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 400;
}

.submit-button:disabled,
.load-more:disabled {
  cursor: default;
  opacity: 0.55;
}

.form-status,
.wall-status {
  min-height: 1.4rem;
  margin-top: 0.55rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.5;
}

.form-status:empty,
.wall-status:empty {
  min-height: 0;
  margin-top: 0;
}

.form-status.is-success,
.wall-status.is-success,
.reply-status.is-success {
  color: #477248;
}

.form-status.is-error,
.wall-status.is-error,
.reply-status.is-error {
  color: #a12828;
}

.entry-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.entry-list {
  display: grid;
  gap: 0;
}

.guestbook-entry {
  padding: 0.75rem 0;
  border-bottom: 1px dotted rgba(212, 200, 176, 0.85);
}

.guestbook-entry:first-child {
  padding-top: 0.35rem;
}

.guestbook-entry:last-child {
  padding-bottom: 0.35rem;
  border-bottom: 0;
}

.entry-line {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  align-items: start;
  column-gap: 0;
}

.entry-nickname,
.entry-separator,
.entry-content {
  font-size: 0.92rem;
  line-height: 1.68;
}

.entry-nickname {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.entry-separator {
  color: var(--text-dim);
}

.entry-content {
  min-width: 0;
  margin: 0;
  color: var(--text-dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.entry-time {
  flex-shrink: 0;
  margin-left: 0.7rem;
  color: var(--text-dim);
  font-size: 0.74rem;
  line-height: 1.68;
  white-space: nowrap;
}

.entry-actions {
  display: flex;
  align-items: flex-start;
  margin-left: 0.7rem;
  line-height: 1.68;
  white-space: nowrap;
}

.reply-toggle {
  display: block;
  border: 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.68;
}

.reply-toggle:hover {
  color: var(--accent-light);
}

.reply-thread {
  margin: 0.35rem 0 0 0.9rem;
  padding-left: 0.7rem;
  border-left: 1px dotted var(--border);
}

.reply-thread[hidden] {
  display: none;
}

.reply-list {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 0.45rem;
}

.reply-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: start;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.55;
}

.reply-nickname {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.reply-content {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.reply-time {
  margin-left: 0.7rem;
  color: var(--text-dim);
  font-size: 0.7rem;
  white-space: nowrap;
}

.reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.4rem;
}

.reply-form-fields {
  display: grid;
  gap: 0.3rem;
}

.reply-form input,
.reply-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.28rem 0.45rem;
  color: var(--text);
  background: var(--tile-bg);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
}

.reply-form textarea {
  min-height: 2.4rem;
  resize: vertical;
}

.reply-form input:focus,
.reply-form textarea:focus {
  border-color: var(--accent-light);
}

.reply-submit {
  border: 0;
  border-radius: 5px;
  padding: 0.3rem 0.65rem;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.reply-submit:disabled {
  cursor: default;
  opacity: 0.55;
}

.reply-status {
  min-height: 1.2rem;
  margin-top: 0.3rem;
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.5;
}

.reply-status:empty {
  min-height: 0;
  margin-top: 0;
}

.empty-state {
  padding: 2.4rem 1rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
}

.load-more:not([hidden]) {
  display: block;
  margin: 0.35rem 0 0;
}

.load-more:hover:not(:disabled) {
  color: var(--accent);
  background: transparent;
}

@media (max-width: 860px) {
  body {
    padding: 1.4rem 0.7rem;
  }

  .guestbook-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .guestbook-layout {
    grid-template-columns: 1fr;
  }

  .compose-card {
    position: static;
  }

  .guestbook-card {
    padding: 0.7rem;
  }

  .wall-card {
    display: block;
    height: auto !important;
    max-height: none !important;
    overflow: visible;
  }

  .entry-scroll {
    overflow: visible;
    padding-right: 0;
  }
}
