/* CSS reset
  https://www.digitalocean.com/community/tutorials/css-minimal-css-reset
 */
html {
  box-sizing: border-box;
  font-size: 16px;
}
*, *:before, *:after {
  box-sizing: inherit;
}
body, h1, h2, h3, h4, h5, h6, p, ol, ul {
  margin: 0;
  padding: 0;
  font-weight: normal;
}
ol, ul {
  list-style: none;
}
img {
  max-width: 100%;
  height: auto;
}

/* Parameters */
:root {
  --form-radius: 5px;
  --form-radius-l: 10px;
}
body.light {
  --color-background: #eee;
  --color-text: #000;
  --color-text-gray: #666;
  --color-link: #0000ff;
  --color-input-form-bg: #fff;
  --color-brl-border: #ccc;
}
body.dark {
  --color-background: #111;
  --color-text: #fff;
  --color-text-gray: #bbb;
  --color-link: #75a5ff;
  --color-input-form-bg: #222;
  --color-brl-border: #333;
}

/* Elements */

a {
  text-decoration: none;
  color: var(--color-link);
}
button {
  cursor: pointer;
}
h1, h2, h3, h4, h5, h6 {
  margin-top: 1rem;
}

html, body {
  height: 100%;
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
}

header {
  padding: 10px;
  border-bottom: 1px solid gray;
  display: flex;
  justify-content: space-between;
  height: 52px;
  width: 100%;
  min-width: 340px;
}
header span {
  display: inline-block;
  vertical-align: middle;
}
header svg {
  display: inline-block;
  vertical-align: middle;
  margin: 0 4px;
}

main {
  margin: 20px auto;
  padding: 0 20px;
  width: 100%;
  max-width: 1100px;
  flex: 1 0 auto; /* flex-grow flex-shrink flex-basis */
}
section {
  margin: 1rem 0;
  width: 100%;
}

footer {
  text-align: center;
  padding: 10px;
}

textarea {
  background-color: var(--color-input-form-bg);
  color: var(--color-text);
  line-height: 1.5rem;
}

svg text {
  font-family: Arial, Helvetica, sans-serif;
}

.brl {
  width: 40px;
  height: 60px;
  border: 1px solid var(--color-brl-border);
}

/* Utils */
.d-none {
  display: none;
}
.btn {
  background-color: #ccc;
  border: 1px solid #888;
  border-radius: var(--form-radius);
  color: black;
  font-size: 1rem;
  font-weight: bold;
  /* margin: 0 10px; */
  padding-top: 6px;
  padding-bottom: 6px;
}
.btn:hover {
  background-color: #aaa;
}

.f-break {
  flex-basis: 100%;
  height: 0;
  border: none;
  margin: 0;
}

/* Classes */

.site-title {
  font-size: 18px;
}
.header-group {
  display: inline-block;
}
.switch-function {
  display: flex block;
  margin: 0 auto 30px;
  width: 300px;
}
.switch-function button {
  background-color: gray;
  border: 1px solid gray;
  color: white;
  font-size: 1rem;
  font-weight: bold;
  margin: 0;
  padding: 6px 24px;
  box-shadow:  0 0 0 1px #c7c7c7;
}
.switch-function button:hover {
  background-color: #008000;
  border: 1px solid #008000;
}
.switch-function .active {
  background-color: #008000;
  border: 1px solid #008000;
}
.switch-function button:first-child {
  border-radius: var(--form-radius-l) 0 0 var(--form-radius-l);
}
.switch-function button:last-child {
  border-radius: 0 var(--form-radius-l) var(--form-radius-l) 0;
}

.border-area {
  border: 1px solid gray;
  border-radius: var(--form-radius);
  margin: 4px 0;
  padding: 10px;
  width: 100%;
}

.input-kana {
  font-size: 1.2rem;
}

.input-tenji {
  min-height: 66px;
  display: flex;
  flex-wrap: wrap;

}

.input-tenji > span {
  display: inline-block;
}

.output-kana {
  font-size: 1.4rem;
  letter-spacing: 0.2rem;
}

.tenji-char {
  font-size: 2.4rem;
  overflow-wrap: break-word;
  line-height: 2.8rem;
  letter-spacing: 0.2rem;
}

.tenji-char > .t-space {
  border: 1px solid gray;
  font-size: 1.4rem;
  line-height: 1rem;
  margin: 4px 6px;
}

.tenji-num-read, .tenji-num-write {
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  line-height: 0.9rem;
}
.tenji-num-read > svg, .tenji-num-write > svg {
  border: 1px solid gray;
  border-radius: 3px;
  font-weight: bold;
  margin: 3px;
}
.tenji-num-read > svg:has([href="#brl-999"]), .tenji-num-write > svg:has([href="#brl-999-rvs"]) {
  border: 1px solid red;
  background-color: rgba(255, 0, 0, 0.1);;
}

.tenji-num-write {
  flex-direction: row-reverse;
}

.btn-exec {
  background-color: #002D80;
  border: 1px solid #8fb6ff;
  color: white;
  display: block;
  font-size: 1.2rem;
  margin: 10px auto;
  width: 200px;
}
.btn-exec:hover {
  background-color: #2d497d;
}

.btn-tenji-input {
  background-color: #4164a4;
  border: 1px solid #2d497d;
  color: white;
  line-height: 3rem;
  width: 150px;
}
.btn-tenji-input:hover {
  background-color: #2d497d;
}

.tenji-input-area {
  display: flex;
  margin: 1rem auto;
  width: 100%;
  max-width: 720px;
  justify-content: space-evenly;
}
.tenji-num-wrapper {
  background-color: var(--color-input-form-bg);
  border: 1px solid gray;
  border-radius: var(--form-radius);
  display: grid;
  font-size: 2rem;
  grid-template-columns: 50px 50px;
  grid-template-rows: 50px 50px 50px;
  grid-auto-flow: column; 
  margin-right: 2rem;
  max-height: 170px;
  padding: 10px;
  text-align: center;
}
.tenji-num-wrapper > .tenji-num {
  color: var(--color-text-gray);
  cursor: pointer;
}
.tenji-num-wrapper > .tenji-num.on {
  color: #e7600b;
  font-weight: 900;
}

.tenji-btn-wrapper {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
}
.tenji-btn-wrapper > .btn {
  width: 120px;
  margin: 4px 4px;
}

.text-svg {
  vertical-align: middle;
  margin: 0 4px 2px;
}

.bg-attention {
  background-color: #e79999;
}
.bg-attention:hover {
  background-color: #d6b1b1;
}

.modal {
  background-color: rgba(0,0,0,0.7);
  height: 100%;
  left: 0;
  overflow: auto;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1;

  visibility: hidden;
  opacity: 0;
  transition: .5s;
}

.show-modal {
  visibility: visible;
  opacity: 1;
  transition: .5s;
}

.modal-content {
  background-color: var(--color-background);
  border: 1px solid #888;
  border-radius: var(--form-radius);
  color: var(--color-text);
  margin: 2rem auto;
  padding: 20px;
  max-width: 94%;
  width: 840px;
}
.modal-title {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
.modal-body {
  line-height: 1.8rem;
}
.modal-body p {
  margin-top: 1rem;
}
.modal-body ul {
  list-style-type: square;
  margin-left: 1rem;
}
.about-heading {
  font-size: 1.2rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.modal-footer {
  margin-top: 1rem;
  overflow: auto;
}

.modal-footer > button {
  float: right;
}

.modal-close {
  color: var(--color-text);
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.modal-close:hover,
.modal-close:focus {
  color: #888;
  text-decoration: none;
  cursor: pointer;
}

code.tenji {
  border: 1px solid gray;
  border-radius: 2px;
  margin: 0 2px;
}
