:root {
  --bg: #0f1420;
  --panel: #161c2c;
  --panel-2: #1c2436;
  --border: #2a3350;
  --text: #e7eaf2;
  --muted: #9aa4bf;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.15);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
}

.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  overflow-y: auto;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar li button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar li button:hover {
  background: var(--panel-2);
  color: var(--text);
}

.sidebar li button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 28px 36px;
  overflow-y: auto;
}

.quote-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 24px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.quote-title {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--accent);
}

.quote-text {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.6;
  font-style: italic;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 14px;
}

.quote-translation {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  opacity: 0.9;
}

.quote-author {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.quote-explanation {
  margin: 0 0 20px;
  padding: 10px 12px;
  background: var(--panel-2);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.quote-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s;
}

.quote-btn:hover {
  background: var(--accent);
  color: #0f1420;
}

.content h2 {
  margin-top: 0;
  font-size: 24px;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 10px;
  display: inline-block;
}

.content h3 {
  color: var(--accent);
  font-size: 16px;
  margin: 28px 0 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 20px;
  font-size: 14px;
}

table th, table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

table th {
  background: var(--panel-2);
  color: var(--accent);
}

table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.logic-block p {
  margin: 6px 0;
  line-height: 1.55;
  color: var(--text);
}

code {
  background: var(--panel-2);
  color: #ffd479;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.rule-box {
  background: rgba(255, 180, 60, 0.1);
  border: 1px solid rgba(255, 180, 60, 0.35);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  line-height: 1.5;
}

.rule-box::before {
  content: "⚠️ ";
}

.questions {
  margin: 10px 0 0;
  padding-left: 20px;
  line-height: 1.7;
}

.questions li {
  margin-bottom: 6px;
}

@media (max-width: 820px) {
  .menu-btn {
    display: inline-block;
  }

  .layout {
    position: relative;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 57px;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 9;
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .content {
    padding: 20px;
  }

  .quote-panel {
    display: none;
  }
}
