@font-face {
  font-family: 'Huninn';
  src: url('fonts/Huninn-Regular.woff2') format('woff2'),
    url('fonts/Huninn-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'BopomofoRuby';
  src: url('/fonts/BopomofoRuby1909-v1-Regular.ttf') format('truetype');
}

html {
  width: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Huninn", "Noto Sans JP", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  background: #b6dfff;
  width: 100%;
  margin: 0;
  padding-top: 70px;
  /* same as header height */
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  padding-left: 16px;
  padding-right: 10px;
  height: 70px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: fixed;
  /* ✅ remove it from layout */

  top: 0;
  z-index: 900;
}

.logo-title a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.logo-title img {
  width: 50px;
  height: 50px;
  margin-right: 10px;
}

.logo-title .logo-text {
  font-size: 24px;
}

.nav-links a {
  margin: 0 10px;
  text-decoration: none;
  color: #333;
}

.theme-toggle {
  width: 25px;
  height: 25px;
  /* display: flex; */
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 16px;
  cursor: pointer;
}

.lang-options {
  font-size: 16px;
}

.lang-options a {
  text-decoration: none;
  color: #555;
}

@media (max-width: 768px) {
  .header-bar {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 10px 15px;
  }

  .logo-title span {
    font-size: 20px;
  }

  .logo-title img {
    width: 40px;
    height: 40px;
    margin-right: 8px;
  }

  .nav-links {
    margin-top: 8px;
  }

  .nav-links a {
    font-size: 14px;
    margin: 4px 8px 0 0;
    display: inline-block;
  }

  .lang-options {
    font-size: 14px;
    margin-top: 6px;
  }

  .lang-options a {
    font-size: 14px;
  }
}

.zhuyin-mode .header-bar .logo-title,
.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row;
  width: 35%;
}

.zhuyin-mode .nav-links {
  width: 40%;
}

.zhuyin-mode .lang-options {
  width: 25%;
}

.zhuyin-mode .logo-title .logo-text {
  font-size: 15px !important;
  
  /* margin-right: 20px; */
}

/* Fix the logo-title link to maintain horizontal layout */
.zhuyin-mode .logo-title a {
  display: flex !important;
  flex-direction: row !important; /* Override the column direction */
  align-items: center !important; /* Vertically center */
  justify-content: flex-start;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.zhuyin-mode .logo-title .logo-text .zhuyin-rt {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 40%;
}

.zhuyin-mode body {
  font-family: 'BopomofoRuby', 'Huninn', serif;
  /* font-size: 1.2em; */
  font-size: large;
}


.zhuyin-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  /* justify-content: flex-end; */
  justify-content: space-between;
  font-family: 'BopomofoRuby', 'Noto Sans TC', sans-serif;

  margin: 0 2px;
  max-height: 4em;
  max-width: 4em;

  writing-mode: vertical-rl;
  /* border: 1px dashed red; */

  /* ✅ 強制垂直模式 */
}

.zhuyin-rt {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 40%;
  /* font-feature-settings: "salt" 1, "vert" 1, "locl" 1; */
  /* font-feature-settings: "vert" 1; */
  /* line-height: 1.2; */
  max-width: 4em;
  /* max-height: 5em; */
  /* height: 3em; */
  color: #00002f;
  margin-right: 3px;
  /* border: 1px dashed green; */
}

.zhuyin-char {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 1.2em;
  height: 1.2em;
  font-size: 1.2em;
  text-align: center;
  /* border: 1px dashed blue; */
}

.zhuyin-mode .header-bar {
    height: 85px;
}

.zhuyin-mode .header-bar a {
  display: inline-block;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 16px !important;
  /* writing-mode: vertical-rl; */
  /* text-orientation: mixed; */
}

.zhuyin-box.no-zhuyin {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 2em !important;
  height: 2em !important;
  /* margin: 0; */
  writing-mode: horizontal-tb;
  opacity: 0.9;
  /* border:1px dotted blue; */
  /* 🔽 加這行往上推一點 */
  transform: translateY(-0.6em);
  /* line-height: 4; */
}

.zhuyin-box.no-zhuyin .zhuyin-char {
  font-size: 1.2em;
  line-height: 1;
  height: 1.2em;
  text-align: center;
  justify-content: center;
  /* border: 1px dotted brown; */
}

.zhuyin-box.halfwidth {
  font-family: "Huninn", "Noto Sans JP";
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto !important;
  height: 2em !important;
  margin: 0 2px;
  padding-left: 4px;
  writing-mode: horizontal-tb;
  opacity: 0.9;
  /* 🔽 加這行往上推一點 */
  transform: translateY(-0.6em);
  /* border:1px dotted magenta; */
}

.zhuyin-box.halfwidth .zhuyin-char {
  font-size: 1em;
  line-height: 1;
  height: 1.2em;
  width: auto;
  text-align: center;
  justify-content: center;
  /* border: 1px dotted red; */
}


@media (max-width: 768px) {
  .zhuyin-mode .header-bar .logo-title,
  .logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row;
    width: 100%;
  }

  .zhuyin-mode .nav-links {
    width: 100%;
  }

  .zhuyin-mode .lang-options {
    width: 100%;
  }
}