/* KW-dynamic.css – for Kanji World */
@charset "UTF-8";

body {
  background: #000 !important;
  color: #fff;
  font-family: sans-serif;
  text-align: center;
  padding: 20px;
}

/* heading */
h1 {
  font-size: 1.6em;
  margin: 0.4em 0 0.6em 0;
  color: burlywood;
  text-align: center;
}

.kanji-page-label {
  text-align: center;
  font-size: 0.9rem;
  color: burlywood; /* warm tone to match "Kanji" logo */
  margin: 0.5rem 0 0.8rem;
  font-weight: 500;
}

.kanji-subtitle {
  font-size: 0.95em;
  color: #7b8b4a;
  font-style: italic;
  margin-top: -1em;
  margin-bottom: 0.8em;
}

/* grid: 3 x 3 Kanji */
.kanji-random09 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  justify-content: center;
  max-width: 360px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.kanji-box {
  background-color: #000 !important;
  padding: 1.2rem;
  border-radius: 10px;
  border: 2px solid #333;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

/* image style inside box (if used) */
.kanji-box img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
  transition: transform 0.2s;
  cursor: pointer;
}

/* Random 4 */
.kanji-random04 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  justify-content: center;
  max-width: 320px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* bottom New 9 */
.kanji-square-refresh {
  margin: 2em auto;
  display: block;               /* centers the button */
	width: 80%;
  max-width: 300px; /* optional cap for large screens */
  padding: 0.7em 1.5em;
  font-size: 1.1em;
  font-weight: bold;
  background-color: darkgoldenrod;
  color: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s ease, transform 0.2s;
}

.kanji-square-refresh:hover {
  background-color: #b8860b;
  transform: scale(1.05);
}

.kanji-search-form {
  display: flex;
  flex: 2;
  gap: 0.5rem;
}

.kanji-search-form input[type="text"] {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.9em;
  border-radius: 4px;
  border: none;
}

.kanji-search-form button {
  padding: 0.5rem 0.8rem;
  background: #333;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.kanji-search-form button:hover {
  background: #555;
}

.kanji-square-refresh {
  padding: 0.6rem;
  font-size: 1.1em;
  font-weight: bold;
  background-color: darkgoldenrod;
  color: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}

.kanji-square-refresh:hover {
  background-color: #a6761d;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .kanji-random09 {
    gap: 1rem;
    padding: 0 0.5rem;
  }

  .kanji-box {
    padding: 1rem;
  }

  .kanji-bottom-bar {
    flex-direction: column;
    gap: 0.8rem;
    padding: 0 1rem;
  }

  .kanji-search-form {
    flex-direction: column;
    gap: 0.5rem;
  }

  .kanji-search-form input,
  .kanji-search-form button,
  .kanji-square-refresh {
    width: 100%;
  }
}

.kanji-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding: 0 2px;
}

.kanji-grid a {
  display: block;
  width: 18%;           /* ~5 per row on large screens */
  max-width: 38px;
  min-width: 32px;
}

.kanji-grid img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 600px) {
  .kanji-grid a {
    width: 18%;         /* 4 per row on small screens */
    max-width: 32px;
  }
}

.kw-tab-container {
  display: flex;
  justify-content: center;
  gap: 1.2rem; /* space between buttons */
  margin-top: 1.5rem; /* optional: adds vertical space */
  flex-wrap: wrap; /* allows wrapping on small screens */
}

.kanji-related {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 2em;
  margin-bottom: 2em;
}

/* Related Kanji */
.related-kanji-img {
  width: 80px;
  height: 80px;
  border: 1px solid #444;
  border-radius: 6px;
  transition: transform 0.2s ease;
}

.related-kanji-img:hover {
  transform: scale(1.08);
}

#kana-grid {
  width: 80%;
  margin: 0 auto;
}

.kana-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0px;
  flex-wrap: wrap;
}

.kana-card {
  width: 16%;
  text-align: center;
  font-family: sans-serif;
}

.kana-img {
  width: 30px;
  max-width: 40px;  /* adjust as needed */
  height: auto;
  margin-bottom: 0;
}

.kana-label {
  width: 4%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8em;
  font-weight: bold;
  color: #c88a2c;
  font-family: sans-serif;
  margin-right: 7%;    /* horizontal spacing */
  margin-bottom: 7px;     /* vertical spacing between rows */
}

.kana-caption {
  font-size: 1em;
  line-height: 1.2em;
}

.level-label {
  color: #b8860b;
  font-size: 1.4em;
  text-align: center;
  margin: 1em auto 0.3em;  /* reduced vertical spacing */
}

.map-grid {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 1em auto 0.5em;
}

.map-grid a {
  display: inline-block;
  padding: 3px;
  font-size: 0.8em;
  border: 1px solid #777;
  color: #eee;
  background: #000;
  border-radius: 2px;
  text-decoration: none;
  text-align: center;
  min-width: 40px;
  box-sizing: border-box;
  transition: background 0.2s, transform 0.2s;
}

.map-grid a:hover {
  background: #b8860b;
  transform: scale(1.03);
}

.level-label a {
  color: olive;
  text-decoration: none;
}

.level-label a:hover {
  text-decoration: none;
  color: orange;
}

.radical-two-col {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.radical-two-col {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
  margin: 2rem auto;
  max-width: 900px;
}

.radical-left {
  flex: 0 0 auto;
  text-align: center;
}

.radical-right {
  max-width: 400px;
  font-size: 1rem;
  line-height: 1.6;
  color: #fff;
}

.radical-meaning {
  margin-top: 1rem;
  font-size: 1rem;
  color: #fff;
}

@media (max-width: 700px) {
  .radical-two-col {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .radical-right {
    max-width: 90%;
  }
}

.radical-note-block {
  background-color: #1a1a1a;
  border-left: 4px solid #7b8b4a;
  padding: 0.5px 15px;
  margin-top: 30px;
  color: #ddd;
  border-radius: 6px;
  max-width: 480px;
  font-size: 1rem;
  line-height: 1.6;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  text-align: left;
}

/* =========================
   Radical Tabs (scoped)
   ========================= */
.radical-tabs {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 1.2em 0 1em;
}

.radical-tabs a {
  flex: 1;
  text-align: center;
  background-color: #313b12;       /* olive like your theme */
  color: antiquewhite;
  border-radius: 10px;
  padding: 0.5em 0.35em;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid #333;
  white-space: nowrap;
  transition: background-color .2s, color .2s, transform .12s ease-out;
  line-height: 1.2;
}

.radical-tabs a:hover {
  background-color: darkolivegreen;
  color: #000;
  transform: translateY(-1px);
}

/* Wider 3-button layout (Home / E-voice / Storyboard) */
.radical-tabs--wide a {
  flex: 0 1 calc(33.333% - 8px);
}

/* KW-dynamic.css — add at the bottom */
.radical-tabs { margin: 30px 0 0; }  /* top | right/left | bottom */

.rad-name { margin:.4em 0 0; font-size:1.05em; }
#rad-xrefs .tag {
  display:inline-block; padding:.1em .5em; margin:.2em .2em 0 0;
  border-radius:999px; background:#273245; color:#cfe2ff; font-size:.85em;
}

.center-tab.kfr-tab {
  background: #6a5a8c;  /* purple example */
  color: #fff;
}
.center-tab.kfr-tab:hover {
  background: #7c6ca1;
}

.map-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.map-grid .break {
  flex-basis: 100%;
  height: 0;
}

/* --- Spin 9: force 4 columns everywhere, even on phones --- */
.spin9-levels-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px;
  max-width: 480px;
  width: 100%;
  margin: 15px auto 0;
}

/* Ensure children don't force 2-up via flex or fixed widths elsewhere */
.spin9-levels-grid > * {
  min-width: 0;               /* allow shrink inside grid track */
  width: auto !important;     /* cancel width:50% styles */
  flex: initial !important;   /* cancel flex: 0 0 50% etc */
}

/* Your button style, with no wrap to keep labels tidy */
.full-btn.spin9-lv {
  text-align: center;
  font-size: clamp(14px, 2.6vw, 16px);
  padding: 10px 0;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Disabled (greyed-out) style */
.full-btn.spin9-lv.disabled {
  background: #555;
  color: #ccc;
  border: 1px solid #777;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.9;
}

/* Responsive fallback for mobile */
@media (max-width: 600px) {
  .spin9-levels-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}