
:root {
  --ink: #2b2b2b;
  --paper: #faf8f4;
  --accent: #6b5b4a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

header {
  text-align: center;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

header h1 {
  font-weight: normal;
  letter-spacing: 0.15em;
}

nav a {
  margin: 0 0.75rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover { text-decoration: underline; }

main h2 {
  font-weight: normal;
  margin-bottom: 1rem;
}

main p { margin-bottom: 1rem; }

a { color: var(--accent); }

.card {
  background: #ffffff;
  border: 1px solid var(--accent);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.card p { margin-bottom: 0.75rem; }

.card p:last-child { margin-bottom: 0; }

.card .subject {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.card summary {
  cursor: pointer;
  color: var(--accent);
}

details.card[open] summary { margin-bottom: 1rem; }

summary::marker { color: var(--accent); }

.term {
  border-bottom: 1px dashed var(--accent);
  cursor: help;
  position: relative;
}

.term-card {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  background: var(--paper);
  border: 1px solid var(--accent);
  padding: 0.85rem 1.1rem;
  width: max-content;
  max-width: min(20rem, calc(100vw - 2rem));
  z-index: 10;
  line-height: 1.5;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  color: var(--ink);
  text-align: left;
  font-style: normal;
  font-weight: normal;
}

.term:hover .term-card,
.term:focus .term-card,
.term:focus-within .term-card {
  display: block;
}

.term-title {
  display: block;
  font-size: 1.15rem;
  font-weight: normal;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.term-pronunciation {
  display: block;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 0.55rem;
}

.term-definition {
  display: block;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
}

@media (max-width: 600px) {
  body {
    padding: 1.5rem 1rem;
  }

  .term:hover::before,
  .term:focus::before,
  .term:focus-within::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(43, 43, 43, 0.45);
    backdrop-filter: blur(1px);
    z-index: 99;
    pointer-events: none;
  }

  .term-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(84vw, 20rem);
    max-width: 20rem;
    padding: 1.25rem 1.4rem;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--accent);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    z-index: 100;
  }

  .term-title {
    font-size: 1.25rem;
    margin-bottom: 0.2rem;
  }

  .term-pronunciation {
    font-size: 0.95rem;
    margin-bottom: 0.65rem;
  }

  .term-definition {
    font-size: 1rem;
    line-height: 1.55;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--accent);
  vertical-align: top;
  background: #ffffff;
}

th {
  font-weight: normal;
  color: var(--paper);
  background: var(--accent);
}

tbody tr:nth-child(even) td {
  background: #f3efe9;
}

td:first-child, td:nth-child(2) {
  white-space: nowrap;
}

tr.optional td {
  color: #9a938a;
}

hr {
  border: 0;
  border-top: 1px solid var(--accent);
  margin: 2.5rem 0;
}

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--accent);
  text-align: center;
  font-size: 0.85rem;
  color: var(--accent);
}
