:root {
  --red: #e5342a;
  --red-dark: #b3241c;
  --yellow: #ffcd3c;
  --yellow-dark: #e6a800;
  --blue: #2e6cf0;
  --blue-dark: #1d4dc0;
  --purple: #8b3fd6;
  --ink: #241428;
  --paper: #fff8ec;
  --card: #ffffff;
  --line: #241428;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 18px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Fredoka", ui-sans-serif, system-ui, sans-serif;
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(circle, rgba(46, 108, 240, 0.10) 3px, transparent 3.5px),
    radial-gradient(circle, rgba(229, 52, 42, 0.08) 3px, transparent 3.5px);
  background-size: 46px 46px, 46px 46px;
  background-position: 0 0, 23px 23px;
}

.tent-stripes {
  height: 14px;
  width: 100%;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 28px,
    var(--yellow) 28px 56px
  );
  border-bottom: 4px solid var(--ink);
}

a { color: var(--blue-dark); }

/* ---------- header ---------- */

.big-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(180deg, #ffe27a, var(--yellow));
  border-bottom: 4px solid var(--ink);
}

.logo {
  font-family: "Bangers", cursive;
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: 0.03em;
  margin: 0;
  line-height: 1;
  color: var(--red);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.logo .feed-word { color: var(--blue); }
.logo .nose { -webkit-text-stroke: 0; text-shadow: none; font-size: 0.8em; }

.tagline {
  margin: 0.15rem 0 0;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.75;
}

.honk-btn {
  font-family: "Bangers", cursive;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  background: var(--red);
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.7rem 1.6rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s ease;
}
.honk-btn:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.honk-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.honk-btn.honking { animation: honk-shake 0.4s ease; }

@keyframes honk-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

/* ---------- ticket bar ---------- */

.ticket-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
  background: var(--blue);
  border-bottom: 4px solid var(--ink);
}

.spacer { flex: 1 1 auto; }

.ticket-btn {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s ease;
}
.ticket-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.ticket-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.ticket-btn-quiet { background: var(--yellow); }

/* ---------- layout ---------- */

.ring {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem 3rem;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}

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

.troupe {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  position: sticky;
  top: 1rem;
}

.troupe-title {
  font-family: "Bangers", cursive;
  letter-spacing: 0.04em;
  font-size: 1.4rem;
  margin: 0 0 0.6rem;
  color: var(--purple);
}

.feed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }

.feed-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  background: var(--paper);
  cursor: pointer;
}
.feed-row.active { background: var(--yellow); }
.feed-row .nose-dot { font-size: 1rem; flex-shrink: 0; }
.feed-row .feed-name {
  flex: 1 1 auto;
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-row .unread-badge {
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  flex-shrink: 0;
}
.feed-row .feed-actions {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
}
.feed-row .feed-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem 0.25rem;
  border-radius: 6px;
}
.feed-row .feed-actions button:hover { background: rgba(0,0,0,0.08); }

.feed-row.errored { border-color: var(--red); }
.feed-row .feed-error-flag { color: var(--red-dark); font-size: 0.8rem; }

.feed-empty {
  font-size: 0.88rem;
  opacity: 0.7;
  font-style: italic;
}

.stage {
  min-width: 0;
}

.stage-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.stage-header h2 {
  font-family: "Bangers", cursive;
  letter-spacing: 0.03em;
  color: var(--red);
  font-size: 1.6rem;
  margin: 0;
}
.stage-count { font-weight: 600; opacity: 0.65; }

.article-list { display: flex; flex-direction: column; gap: 0.9rem; }

.article-card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.article-card:nth-child(3n+1) { transform: rotate(-0.6deg); }
.article-card:nth-child(3n+2) { transform: rotate(0.5deg); }
.article-card:nth-child(3n+3) { transform: rotate(-0.3deg); }
.article-card:hover {
  transform: rotate(0deg) translate(-2px, -2px);
  box-shadow: var(--shadow);
}

.article-card.unread { border-color: var(--red); }
.article-card.unread .article-title::before {
  content: "🎈 ";
}

.article-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
}
.article-meta {
  font-size: 0.8rem;
  opacity: 0.65;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.article-snippet {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-empty, .loading-state {
  font-size: 1rem;
  opacity: 0.7;
  padding: 2rem 1rem;
  text-align: center;
}

/* ---------- reader ---------- */

.reader {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(620px, 100%);
  background: var(--paper);
  border-left: 4px solid var(--ink);
  box-shadow: -8px 0 0 rgba(0,0,0,0.15);
  overflow-y: auto;
  z-index: 50;
  padding: 1.5rem;
}

.reader-close {
  position: sticky;
  top: 0;
  float: right;
  background: var(--red);
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.reader-body h1 {
  font-family: "Bangers", cursive;
  color: var(--purple);
  font-size: 1.9rem;
  letter-spacing: 0.02em;
  margin: 0.2rem 0 0.4rem;
}

.reader-meta {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 1rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
}

.reader-content {
  line-height: 1.65;
  font-size: 1rem;
}
.reader-content img { max-width: 100%; border-radius: 10px; border: 2px solid var(--ink); }
.reader-content a { text-decoration: underline; }
.reader-content pre { overflow-x: auto; background: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 0.6rem; }
.reader-content blockquote {
  border-left: 4px solid var(--yellow-dark);
  margin: 0.8rem 0;
  padding: 0.2rem 0 0.2rem 0.8rem;
  opacity: 0.85;
}

.reader-original-link {
  display: inline-block;
  margin-top: 1.25rem;
  font-family: "Bangers", cursive;
  letter-spacing: 0.03em;
  background: var(--blue);
  color: #fff;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 3px solid var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 20, 40, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

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

.circus-card {
  background: var(--card);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  width: min(440px, 100%);
  position: relative;
}

.circus-card h3 {
  font-family: "Bangers", cursive;
  color: var(--red);
  font-size: 1.6rem;
  margin: 0 0 1rem;
}

.circus-card label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.9rem;
}
.circus-card label .hint { font-weight: 400; opacity: 0.65; font-size: 0.8rem; }

.circus-card input[type="text"],
.circus-card input[type="url"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
}

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-actions { margin-top: 0.5rem; }

.form-error {
  color: var(--red-dark);
  font-weight: 600;
  font-size: 0.88rem;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

/* ---------- footer ---------- */

.bigtop-footer {
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.7;
  padding: 1.5rem;
}
