:root {
  --bg: #f5ebd9;
  --ink: #241410;
  --muted: #6e584d;
  --line: #d8c2a3;
  --accent: #51142c;
  --accent2: #ab592c;
  --card: #fbf2e4;
  --shade: 0 4px 14px rgba(36, 20, 16, 0.08);
}

.walnut {
  --bg: #efe2cd;
  --card: #f8ecd8;
  --line: #cdb28d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 12px 12px 84px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

#app {
  max-width: 560px;
  margin: 0 auto;
}

h1, h2, h3, h4, p {
  margin: 0 0 8px;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

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

.gap {
  margin-top: 12px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shade);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}

button {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff9f0;
  cursor: pointer;
  font-weight: 600;
}

button.primary {
  background: var(--accent);
  color: #fff7eb;
  border-color: var(--accent);
}

button.flat {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

button.full {
  width: 100%;
  margin-top: 6px;
}

button.listbtn {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
}

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  margin-bottom: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffdf9;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.mast {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 18px;
  color: var(--accent);
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}

.tag {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
}

.banner {
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 10px;
  display: block;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff7eb;
  display: grid;
  place-items: center;
  font-weight: 700;
  padding: 0;
  overflow: hidden;
  flex: none;
}

.avatar.big {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

.avatar img.face {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.online-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 12px;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22a055;
  display: inline-block;
}

.online-chip {
  background: #efe1cb;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.lvl-badge {
  background: #f2dfc2;
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.chip {
  background: #efe1cb;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.entry {
  padding: 8px 0;
  border-bottom: 1px solid #ead8be;
}

.entry:last-child {
  border-bottom: 0;
}

.guidebox, .notice {
  background: #fdf5e6;
  border: 1px solid #dfbe93;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

.countdown-box {
  background: var(--accent);
  color: #fff6e8;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
  font-weight: 800;
  margin: 8px 0;
  letter-spacing: 0.4px;
}

.prog-wrap {
  height: 8px;
  background: #e6d3b8;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.prog-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
}

.chat-box {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.chat-msg {
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff9f0;
  border: 1px solid #e7d5bc;
  font-size: 13px;
}

.chat-msg.me {
  background: #f6e4d2;
  border-color: #d6ad88;
}

.chat-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.chat-form input {
  margin: 0;
  flex: 1;
}

.stories-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
}

.story-ring {
  flex: none;
  width: 74px;
  text-align: center;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
  color: var(--ink);
}

.story-circle {
  width: 64px;
  height: 64px;
  margin: 0 auto 4px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #ab592c, #51142c);
  display: grid;
  place-items: center;
}

.story-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff6e8;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: bold;
}

.story-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-name {
  font-size: 11px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow:ellipsis;
}

.story-card {
  border-radius: 16px;
  padding: 22px 16px;
  color: #fff7e8;
  text-align: center;
  margin: 8px 0;
}

.story-card.wine {
  background: linear-gradient(135deg, #51142c, #8a2d43);
}

.story-card.gold {
  background: linear-gradient(135deg, #8a5a19, #c78c34);
}

.story-card.forest {
  background: linear-gradient(135deg, #214d35, #3d7a55);
}

.post-card {
  background: #faeedc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shade);
}

.post-media {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 10px;
  margin: 8px 0;
  border: 1px solid var(--line);
}

.rels-box {
  background: #2d101c;
  color: #fff4e2;
  border-radius: 12px;
  padding: 14px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-item {
  font-size: 13px;
  padding: 5px 0;
  border-top: 1px solid #e6d5bc;
}

#nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #fbf2e4;
  border-top: 1px solid var(--line);
  padding: 4px 2px;
  z-index: 50;
}

#nav button {
  border: 0;
  background: transparent;
  padding: 4px 2px;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
}

#nav button.on {
  color: var(--accent);
  font-weight: 700;
}

#nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

#toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 66px;
  max-width: 540px;
  margin: 0 auto;
  text-align: center;
  pointer-events: none;
  z-index: 60;
}

#toast:not(:empty) {
  background: #241410;
  color: #fff7eb;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  max-width: 440px;
  width: calc(100% - 24px);
  padding: 16px;
}
