/* ============ HodderNet shared stylesheet ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Trebuchet MS", "Comic Sans MS", Verdana, sans-serif;
  background: linear-gradient(160deg, #a8e6ff 0%, #fdf6c9 50%, #c9f7d0 100%);
  background-attachment: fixed;
  color: #2b2b2b;
  min-height: 100vh;
}

/* ---------- Site pages ---------- */
.site-header {
  background: #ff8fab;
  border-bottom: 6px dotted #fff;
  padding: 18px 16px 22px;
  text-align: center;
  box-shadow: 0 4px 0 rgba(0,0,0,.08);
}
.site-header h1 { color: #fff; font-size: 2.2rem; text-shadow: 2px 2px 0 #d16a86; }
.back-home {
  display: inline-block; background: #fff; color: #d6336c; font-weight: bold;
  padding: 8px 18px; border-radius: 999px; text-decoration: none; margin-bottom: 10px;
  border: 3px solid #ffd6e0; box-shadow: 0 3px 0 #e5a;
}
.back-home:hover { background: #fff0f4; transform: translateY(-2px); }
.container { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.card {
  background: #fff; border-radius: 22px; padding: 22px; margin-bottom: 22px;
  border: 4px solid #ffb3c6; box-shadow: 0 6px 0 rgba(0,0,0,.07);
}
.card:nth-of-type(even) { border-color: #a0d8ff; }
.card h2 { color: #d6336c; margin-bottom: 14px; font-size: 1.5rem; }
.card p { line-height: 1.55; margin-bottom: 10px; }
.factgrid { display: grid; gap: 10px; }
.fact {
  background: #fff9db; border: 3px dashed #ffd43b; border-radius: 14px; padding: 10px 14px; line-height: 1.4;
}
details.reveal { background: #e7f5ff; border: 3px solid #74c0fc; border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; }
details.reveal summary { cursor: pointer; font-weight: bold; color: #1971c2; }
details.reveal p { margin-top: 8px; }
.quiz-item { margin-bottom: 16px; }
.quiz-q { font-weight: bold; margin-bottom: 8px; }
.quiz-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.quiz-opt {
  font-family: inherit; font-size: 1rem; background: #f3f0ff; border: 3px solid #b197fc;
  border-radius: 999px; padding: 8px 16px; cursor: pointer; color: #2b2b2b;
}
.quiz-opt:hover { background: #e5dbff; }
.quiz-opt.correct { background: #b2f2bb; border-color: #2b8a3e; font-weight: bold; }
.quiz-opt.wrong { background: #ffc9c9; border-color: #e03131; }
.quiz-score { font-size: 1.3rem; font-weight: bold; color: #2b8a3e; min-height: 1.6em; margin-top: 8px; }
/* ---------- Portal ---------- */
.portal-hero { text-align: center; padding: 34px 16px 10px; }
.portal-hero h1 {
  font-size: 3rem; color: #fff; text-shadow: 3px 3px 0 #ff8fab, 6px 6px 0 #1971c2; letter-spacing: 2px;
}
.portal-hero p.tagline { margin-top: 10px; font-size: 1.15rem; color: #495057; font-weight: bold; }
.searchbar { text-align: center; padding: 14px; }
.searchbar input {
  width: min(560px, 92%); font-family: inherit; font-size: 1.15rem; padding: 12px 20px;
  border-radius: 999px; border: 4px solid #74c0fc; outline: none; background: #fff;
}
.filterbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 16px 18px; }
.filterbtn {
  font-family: inherit; font-size: .95rem; font-weight: bold; background: #fff; color: #495057;
  border: 3px solid #adb5bd; border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.filterbtn.active { background: #ff8fab; border-color: #d6336c; color: #fff; }
.section-label {
  max-width: 1100px; margin: 26px auto 8px; padding: 0 20px;
  font-size: 1.4rem; color: #1971c2; text-shadow: 1px 1px 0 #fff;
}
.tilegrid {
  max-width: 1100px; margin: 0 auto; padding: 6px 16px 26px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px;
}
.tile {
  display: block; background: #fff; border-radius: 20px; padding: 18px 14px; text-align: center;
  text-decoration: none; color: #2b2b2b; border: 4px solid #ffd43b; box-shadow: 0 5px 0 rgba(0,0,0,.08);
  transition: transform .08s ease;
}
.tile:nth-child(3n+2) { border-color: #74c0fc; }
.tile:nth-child(3n) { border-color: #8ce99a; }
.tile:hover { transform: translateY(-4px) rotate(-1deg); background: #fffbe6; }
.tile .emoji { font-size: 2.6rem; display: block; }
.tile .name { font-weight: bold; font-size: 1.05rem; display: block; margin-top: 6px; color: #d6336c; }
.tile.hidden { display: none; }
.toolgrid { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; padding: 6px 16px 50px; }
.toolbtn {
  font-family: inherit; font-size: 1.1rem; font-weight: bold; background: #b2f2bb; border: 4px solid #2b8a3e;
  border-radius: 20px; padding: 14px 26px; cursor: pointer; color: #2b2b2b;
}
.toolbtn:hover { background: #8ce99a; }
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; padding: 20px; overflow: auto; }
.modal.open { display: flex; align-items: flex-start; justify-content: center; }
.modal-panel {
  background: #fff; border-radius: 22px; border: 5px solid #74c0fc; max-width: 640px; width: 100%;
  padding: 22px; position: relative; margin-top: 4vh;
}
.modal-close {
  position: absolute; top: 8px; right: 12px; font-size: 1.6rem; background: none; border: none; cursor: pointer; color: #e03131; font-weight: bold;
}
.modal-panel h2 { color: #1971c2; margin-bottom: 14px; text-align: center; }
.calc-display {
  width: 100%; font-size: 1.8rem; text-align: right; padding: 10px 14px; margin-bottom: 10px;
  border: 4px solid #b197fc; border-radius: 14px; background: #f3f0ff; font-family: inherit;
}
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-grid button {
  font-family: inherit; font-size: 1.3rem; padding: 14px 0; border-radius: 14px; border: 3px solid #74c0fc;
  background: #e7f5ff; cursor: pointer; font-weight: bold;
}
.calc-grid button.op { background: #fff0f6; border-color: #f783ac; }
.msgform { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.msgform input, .msgform textarea {
  font-family: inherit; font-size: 1rem; padding: 10px; border: 3px solid #8ce99a; border-radius: 12px; outline: none;
}
.msgform button {
  font-family: inherit; font-size: 1.1rem; font-weight: bold; background: #8ce99a; border: 3px solid #2b8a3e;
  border-radius: 999px; padding: 10px; cursor: pointer;
}
.msglist { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.msg { background: #fff9db; border: 3px dashed #ffd43b; border-radius: 12px; padding: 8px 12px; }
.msg .who { font-weight: bold; color: #d6336c; }
.msg .when { font-size: .8rem; color: #868e96; }
.drawtools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; cursor: pointer; box-shadow: 0 0 0 2px #adb5bd; }
.swatch.active { box-shadow: 0 0 0 3px #2b8a3e; transform: scale(1.15); }
.drawtools button { font-family: inherit; font-weight: bold; padding: 8px 14px; border-radius: 999px; border: 3px solid #74c0fc; background: #e7f5ff; cursor: pointer; }
#drawcanvas { border: 4px solid #b197fc; border-radius: 14px; background: #fff; touch-action: none; width: 100%; }
footer.portal-footer { text-align: center; padding: 10px 16px 40px; color: #868e96; font-size: .9rem; }
@media (max-width: 520px) {
  .portal-hero h1 { font-size: 2.1rem; }
  .site-header h1 { font-size: 1.6rem; }
}