:root {
  --bg: #fcf9f4;
  --text: #222;
  --highlight: #f0ebe2;
  --accent: #394867;
  --header: #1e1e2f;
  --code-bg: #f6f6f6;
  --border: #dcdcdc;
  --math-bg: #fffdf7;
}

html {
  font-size: 16px;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

body {
  max-width: 61.8rem;
  margin: auto;
  padding: 2rem;
  font-family: 'Georgia', serif;
  background-color: var(--bg);
  background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
  background-repeat: repeat;
}

h1, h2, h3 {
  font-family: 'Palatino Linotype', serif;
  color: var(--header);
  line-height: 1.3;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.4rem;
  text-align: center;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  text-align: center;
}

p, li {
  font-size: 1.05rem;
  margin: 1rem 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}
a:hover {
  color: darkblue;
}

.controls {
  text-align: center;
  margin: 2rem 0 1rem 0;
}
.controls input[type="number"],
.controls input[type="range"] {
  margin: 0 0.5rem;
}
.controls button {
  padding: 0.5rem 1.2rem;
  margin-left: 0.5rem;
  font-size: 1rem;
  background-color: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 4px;
}
.controls button:hover {
  background-color: #2c3e50;
}

.center {
  text-align: center;
}

table {
  border-collapse: collapse;
  margin: auto;
  background-color: var(--highlight);
}

td {
  width: 70px;
  height: 50px;
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  border: 1px solid var(--border);
  background-color: #fdfdfd;
  transition: background 0.3s;
}
td.highlight {
  background-color: #f7c948 !important;
}
td.visited {
  background-color: #d4edda;
}

.math.inline {
  background: var(--math-bg);
  padding: 0.5rem;
  border-radius: 6px;
  display: inline-block;
  margin: 0.5rem 0;
}

.math.display {
  display: block;
  text-align: center;
  font-size: 1.2rem;
  margin: 1rem auto;
}


.table-pair {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 2rem auto;
  flex-wrap: wrap;
}

.table-pair table {
  margin: 1.618px;
}


.table-pair table {
  border-collapse: collapse;
  min-width: 300px;
  background-color: var(--highlight);
}

.table-pair caption {
  caption-side: top;
  font-weight: bold;
  padding: 0.5rem;
  background-color: #eee;
  text-align: center;
}

.table-pair td {
  width: 40px;
  height: 40px;
  text-align: center;
  border: 1px solid var(--border);
  font-weight: bold;
}

td.final-highlight {
  background-color: #3a86ff !important; /* Deep blue */
  color: white;
}

td.highlight {
  background-color: #f7c948 !important;
}

td.visited {
  background-color: #d4edda !important;
}

.tcolorbox {
  background: rgba(255, 248, 220, 0.6); /* antique paper color */
  border: 2px solid #8b5e3c;
  border-radius: 12px;
  margin: 2rem 0;
  padding: 1.5rem;
  box-shadow: 0 0 20px rgba(0,0,0,0.25);
  font-family: 'Georgia', serif;
}

.tcolorbox-title {
  background-color: #d2b48c;
  color: #3b2f2f;
  font-weight: bold;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #8b5e3c;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  text-align: center;
  font-family: 'Caveat', cursive;
}

.tcolorbox-body {
  color: #2c1b0f;
  font-size: 0.618em;
  line-height: 1.65;
}

.tcolorbox-body::first-letter {
  font-size: 160%;
  font-weight: bold;
  color: #8b4513;
  margin-right: 6px;
  float: left;
  line-height: 1;
}


