:root {
  --ink: #23272b;
  --line: #c9c7c0;
  --edge: #3f434a;
  --paper: #ffffff;
  --muted: #8a8f96;
  --accent: #2c6e9c;
  --algo: #c0392b;
  --green: #159a7a;
  --amber: #b8860b;
  --comm: #6c3483;
  --bg: #f2f1ec;
  --shadow: rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* Header & Top Bar */
header.top {
  padding: 24px 30px 16px;
  background: #fff;
  border-bottom: 1px solid #e2e0d8;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

h1 {
  font-size: 21px;
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--ink);
}

.sub {
  color: var(--muted);
  max-width: 850px;
  font-size: 13px;
}

/* View Switcher Controls */
.view-switcher {
  display: flex;
  gap: 8px;
  background: #f0efe9;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.mode-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--edge);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-btn.active, .mode-btn:hover {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Main Container Layouts */
.main-wrapper {
  padding: 24px 30px 48px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Phone Simulator View */
.phone-simulator-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  padding: 20px 0;
}

.phone {
  width: 340px;
  min-height: 680px;
  background: var(--paper);
  border: 2px solid var(--edge);
  border-radius: 36px;
  padding: 20px 18px 24px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bar {
  height: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #a0a0a0;
  font-size: 11px;
  margin-bottom: 12px;
  font-weight: 600;
}

.bar a {
  color: inherit;
  text-decoration: none;
}

.appheader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.appname {
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.4px;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
}

.algo-icon {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--algo);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--algo);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s;
}

.algo-icon:hover {
  transform: scale(1.1);
  background: #fdf2f0;
}

/* Feed Cards */
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin: 14px 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: #b0ada3;
}

.author {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.lorem {
  color: #4a4e54;
  font-size: 12.5px;
  margin: 6px 0 10px;
  line-height: 1.45;
}

.topics {
  margin: 8px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.topic {
  display: inline-block;
  font-weight: 600;
  padding: 3px 11px;
  border: 1px solid #d7d5cd;
  border-radius: 20px;
  font-size: 11.5px;
  color: #5a5f66;
  text-decoration: none;
  transition: all 0.15s;
}

.topic:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
}

.t1 { color: #b03a2e; border-color: #e6b0aa; background: #fdf2f0; }
.t2 { color: #1f6f8b; border-color: #aed6f1; background: #f0f7fb; }
.t3 { color: #6c3483; border-color: #d7bde2; background: #f8f3fb; }
.t4 { color: #1e8449; border-color: #a9dfbf; background: #f0f9f4; }

.kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #a7abb1;
  margin-top: 4px;
  text-transform: uppercase;
}

/* Media placeholder */
.media {
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 10px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #faf9f6;
}

.play {
  width: 34px;
  height: 34px;
  border: 1.5px solid #c4c2ba;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9a9890;
  font-size: 12px;
}

.media .cap {
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 9.5px;
  color: #9a9890;
  font-weight: 600;
}

/* Community Context Bar */
.ctxbar {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 1.5px solid var(--comm);
  border-radius: 12px;
  padding: 10px 14px;
  background: #f8f3fb;
  color: var(--comm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.ctxbar:hover {
  background: #f1e6f7;
  transform: translateY(-1px);
}

.ctxbar .top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
}

.ctxbar .top .carw {
  margin-left: auto;
  font-size: 15px;
  transition: transform 0.2s;
}

.ctxbar:hover .top .carw {
  transform: translateX(3px);
}

.ctxbar .ci {
  font-size: 14px;
}

.ctxbar .cmeta {
  font-size: 10.5px;
  color: #8d6ba3;
  margin-top: 4px;
  font-weight: 500;
}

/* Terminal state */
.terminal {
  border: 1.5px dashed var(--green);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  color: var(--green);
  font-weight: 700;
  margin-top: 16px;
  background: #f2fbf8;
  font-size: 13px;
}

.terminal small {
  font-weight: 400;
  font-size: 11px;
  color: #559b8a;
  display: block;
  margin-top: 4px;
}

/* Flags */
.flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: #8a6d0b;
  background: #fdf8ec;
  border: 1px solid #ecdca6;
  border-radius: 20px;
  padding: 2px 10px;
  cursor: pointer;
  text-decoration: none;
}

.flag:hover {
  background: #f9eed0;
}

/* Modals & Overlays */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(35, 35, 35, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 34px;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.overlay.bottom {
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal {
  background: #fff;
  border-radius: 20px;
  padding: 22px 18px 18px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.25);
  text-align: center;
  width: 100%;
}

.sheet {
  background: #fff;
  width: 100%;
  border-radius: 22px 22px 34px 34px;
  padding: 16px 18px 22px;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
  animation: slideUp 0.25s ease-out;
}

.grab {
  width: 42px;
  height: 4px;
  border-radius: 3px;
  background: #d8d5cd;
  margin: 0 auto 14px;
}

.flag-lg {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fdf8ec;
  border: 1px solid #ecdca6;
  color: #8a6d0b;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 20px;
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  margin: 8px 0;
  background: #fff;
  font-size: 12.5px;
  color: #41464c;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn:hover {
  background: #f7f6f2;
  border-color: #b5b2a6;
}

.btn.primary {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  background: #f2f7fa;
}

.btn.primary:hover {
  background: #e4f0f6;
}

.btn.comm {
  border-color: var(--comm);
  color: var(--comm);
  font-weight: 700;
  background: #f8f3fb;
}

.btn.algo {
  border-color: var(--algo);
  color: var(--algo);
  font-weight: 700;
  background: #fdf3f2;
}

.btn.warn {
  border-color: var(--amber);
  color: #8a6d0b;
  background: #fdf8ec;
}

/* Context view details */
.h2 {
  font-weight: 800;
  font-size: 16px;
  margin: 2px 0 4px;
  color: var(--ink);
}

.sub2 {
  font-size: 12.5px;
  color: #63676d;
  line-height: 1.45;
}

.xnote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  color: #555a62;
  background: #f4f2ec;
  border: 1px solid #e4e1d8;
  border-radius: 10px;
  padding: 8px 11px;
  margin: 10px 0 6px;
}

.xnote .xi {
  font-size: 14px;
}

.sparse {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8a6d0b;
  background: #fdf8ec;
  border: 1px solid #ecdca6;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0 4px;
}

.emptyview {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 14px;
  margin: 10px 0;
  font-size: 12px;
  color: #a7abb1;
  text-align: center;
  line-height: 1.4;
}

.sec {
  border-top: 1px solid #efeee8;
  padding-top: 12px;
  margin-top: 14px;
}

.sec:first-of-type {
  border-top: none;
}

.lab {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #a7abb1;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.viewgroup {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  margin: 10px 0;
  background: #fff;
}

.viewgroup .vhead {
  font-weight: 700;
  font-size: 13px;
  color: #33383d;
}

.viewgroup .vsub {
  font-size: 11.5px;
  color: var(--muted);
  margin: 2px 0 8px;
}

.src {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--accent);
  margin: 6px 0;
}

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

.src a:hover {
  text-decoration: underline;
}

.src .up {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: #54585e;
  background: #f0efe9;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 10px;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.src .up:hover {
  background: #e4e2d8;
}

/* Comments Section */
.cmt {
  border-top: 1px solid #efeee8;
  padding-top: 10px;
  margin-top: 10px;
}

.cmt .ca {
  font-weight: 700;
  font-size: 12px;
  color: #54585e;
}

.cmt .ctext {
  font-size: 12px;
  color: #41464c;
  margin: 3px 0;
  line-height: 1.4;
}

.cmt .csrc {
  font-size: 10.5px;
  color: var(--accent);
  font-weight: 600;
}

.reply {
  margin-left: 14px;
  border-left: 2.5px solid #eceae2;
  padding-left: 10px;
  margin-top: 8px;
}

.cact {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--comm);
  font-weight: 700;
  margin-top: 6px;
  cursor: pointer;
}

.cact button {
  background: none;
  border: none;
  color: var(--comm);
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}

.composer {
  border: 1.5px dashed var(--comm);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 16px;
  color: var(--comm);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  background: #fcf9fe;
  text-align: center;
}

.composer:hover {
  background: #f6ecfa;
}

/* Action Bar */
.actionbar {
  display: flex;
  gap: 12px;
  align-items: center;
  border-top: 1.5px solid #e6e4dc;
  margin-top: 16px;
  padding-top: 14px;
}

.ab-vote {
  display: flex;
  gap: 12px;
  color: #787d84;
  font-size: 16px;
  flex: 0 0 auto;
}

.ab-vote button {
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--edge);
  font-weight: 700;
}

.ab-vote button:hover {
  background: #f0efe9;
}

.ab-btn {
  flex: 1;
  text-align: center;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  text-decoration: none;

}

.ab-btn.share {
  border-color: var(--accent);
  color: var(--accent);
  background: #f2f7fa;
}

/* Spectrum & Algorithm Graphics */
.spectrum {
  height: 10px;
  border-radius: 5px;
  margin: 8px 0 4px;
  background: linear-gradient(90deg, #9fc7bd, #e8e6df, #c9b3d6);
}

.spectrum-lab {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

.node {
  width: 60px;
  height: 60px;
  border: 2px solid var(--algo);
  border-radius: 50%;
  position: relative;
  margin: 14px auto 24px;
}

.node::before, .node::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--algo);
  border-radius: 50%;
}

.node::before { top: -14px; left: -14px; }
.node::after { bottom: -14px; right: -14px; }

.rowitem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  margin: 8px 0;
  color: #54585e;
}

.pill {
  font-size: 10.5px;
  padding: 3px 10px;
  border-radius: 12px;
  background: #f0efe9;
  color: #6b6f75;
  font-weight: 700;
}

/* Grid Mode Multi-Screen View */
.grid-wrapper {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.row-section {
  border-top: 1px solid #e2e0d8;
  padding-top: 20px;
}

.rowlabel {
  font-size: 15px;
  font-weight: 800;
  color: var(--comm);
  letter-spacing: 0.3px;
}

.rowsub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  max-width: 900px;
}

.frames {
  display: flex;
  gap: 30px;
  overflow-x: auto;
  padding: 16px 0 24px;
  align-items: flex-start;
}

.frame {
  flex: 0 0 340px;
}

.flabel {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--edge);
}

.req {
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.req .rl {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--comm);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.req ul {
  margin: 0;
  padding-left: 18px;
}

.req li {
  font-size: 11.5px;
  color: #61666e;
  margin: 4px 0;
  line-height: 1.4;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Form controls */
input[type="text"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: inherit;
  margin: 6px 0;
}

input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(44, 110, 156, 0.15);
}
