
/******************************************************************************
 * Full-height page with sticky footer
 */

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background-color: #ccc;
}

#metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-top: 10px;
}

.level-toggle {
  display: inline-block;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #d0d0d0;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.level-toggle-table {
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 18px;
  width: 100%;
  table-layout: fixed;
}

.level-toggle-key-row {
  border-bottom: 1px solid #e0e0e0;
}

.level-toggle-key-cell {
  padding: 2px 8px 4px;
  text-align: center;
  font-size: 16.8px;
  font-weight: 500;
  color: #666;
  border: none;
  background: transparent;
}

.level-toggle-name-cell {
  padding: 0;
  border: none;
  background: transparent;
}

.level-toggle button {
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 18px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  display: block;
  width: 100%;
  min-width: 24px;
}

.level-toggle button.active {
  background-color: #444;
  color: #fff;
}

.level-toggle button:focus-visible {
  outline: 2px solid #0066ff;
  outline-offset: 1px;
}

#wrapper, #footer {
  width: 850px;
}

#wrapper {
  position: relative;
  min-height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  border-left: 1px solid #aaa;
  border-right: 1px solid #aaa;
  background-color: white;
   -webkit-box-shadow: 0px 1px 10px #888;
      -moz-box-shadow: 0px 1px 10px #888;
       -ms-box-shadow: 0px 1px 10px #888;
        -o-box-shadow: 0px 1px 10px #888;
           box-shadow: 0px 1px 10px #888;
}

* html #wrapper { /* IE6 does not support min-height */
  height: 100%;
}

#content {
  padding-left: 30px;
  padding-bottom: 40px; /* >= height of the footer */
  background-color: white;
}

#footer {
  position: absolute;
  bottom: 0;
  height: 34px; /* 34 + 1 + 5 = 40px */
  border-top: 1px outset #999;
  padding-top: 5px;
  font-size: smaller;
  color: #666;
  text-align: center;
  background-color: white;
  z-index: 2;
}


/******************************************************************************
 * Main text prompt/input area
 */

#lessonInput {
  padding: 1em 0;
}

.prompt-display {
  font-size: 50px;
  font-weight: 800;
  line-height: 1.4;
  white-space: pre-wrap;
  width: 100%;
}

.prompt-display .prompt-table {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  border: 1px solid #c8c8c8;
  border-radius: 10px;
  overflow: hidden;
  background-color: #fff;
  margin: 0 auto;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  max-width: 100%;
  width: 100%;
}

.prompt-table__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 18px;
  min-width: 90px;
  flex: 1;
  box-sizing: border-box;
  background-color: #fff;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.prompt-table__cell + .prompt-table__cell {
  border-left: 1px solid #d7d7d7;
}

.prompt-table__cell.is-active {
  background-color: rgba(0, 0, 0, 0.05);
}

.prompt-table__cell.is-completed {
  opacity: 0.55;
}

.prompt-table__kana {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1em;
  line-height: 1.1;
  letter-spacing: 0.05em;
}

.prompt-table__romaji {
  width: 100%;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d7d7d7;
  text-align: center;
  font-weight: 600;
  font-size: 1.35em;
  line-height: 1.2;
  letter-spacing: 0.08em;
}

.prompt-table__romaji .next-char {
  font-weight: 800;
}

.prompt-display .prompt-display-text {
  font-weight: 500;
  margin-bottom: 0.25em;
}

.prompt-display .prompt-input-text {
  font-weight: 800;
}

.prompt-display .next-char {
  color: #d00;
}

.prompt-display .next-char-space {
  display: inline-block;
  min-width: 0.6em;
  background-color: rgba(221, 0, 0, 0.25);
  border-radius: 3px;
}

.prompt-display.error {
  animation: promptFlash 0.15s linear;
}


/******************************************************************************
 * Startup modal
 */

body.startup-modal-open {
  overflow: hidden;
}

.startup-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.65);
  z-index: 3000;
}

.startup-modal {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px 28px;
  box-sizing: border-box;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.startup-modal__title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #333333;
}

.startup-modal__message {
  overflow-y: auto;
  max-height: 55vh;
  padding-right: 4px;
}

.startup-modal__message:focus {
  outline: none;
}

.startup-modal__message h2,
.startup-modal__message h3,
.startup-modal__message h4 {
  margin: 1.2em 0 0.6em;
  font-weight: 700;
  color: #333333;
}

.startup-modal__message h2:first-child,
.startup-modal__message h3:first-child,
.startup-modal__message h4:first-child {
  margin-top: 0;
}

.startup-modal__message p {
  margin: 0 0 0.9em;
  line-height: 1.6;
  color: #333333;
  font-size: 16px;
  font-weight: 500;
}

.startup-modal__message hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 24px 0;
}

.startup-modal__loading {
  margin: 0;
  font-size: 16px;
  color: #555555;
}

.startup-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.startup-modal__button {
  min-width: 120px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #0078ff, #00c7b7);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 18px rgba(0, 120, 255, 0.3);
}

.startup-modal__button--secondary {
  background: linear-gradient(135deg, #6c757d, #495057);
  box-shadow: 0 6px 18px rgba(108, 117, 125, 0.3);
}

.startup-modal__button--secondary:hover {
  box-shadow: 0 10px 24px rgba(108, 117, 125, 0.4);
}

.startup-modal__button:focus-visible {
  outline: 3px solid rgba(0, 120, 255, 0.35);
  outline-offset: 2px;
}

.startup-modal__button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 120, 255, 0.4);
}

.startup-modal__button:active {
  transform: translateY(0);
  box-shadow: 0 6px 18px rgba(0, 120, 255, 0.35);
}

@keyframes promptFlash {
  from {
    background-color: rgba(255, 0, 0, 0.35);
  }
  to {
    background-color: transparent;
  }
}

#lessonInput #txtInput {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.hints #lessonInput .prompt-display {
  width: 100%;
}


/******************************************************************************
 * Visual hints: colored keys
 */

.hints li.active,
.hints ul#keyboard li.specialKey.active {
  position: relative;
  background-color: brown;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 0 rgba(255, 255, 255, 0.6);
  transform: translateY(0) scale(1);
  animation: nextKeyPulse 1.1s ease-in-out infinite;
}

.hints li.active * {
  font-weight: bold;
  color: white;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.65);
}

@keyframes nextKeyPulse {
  0%, 100% {
    transform: translateY(0) scale(1);
    background-color: brown;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 0 rgba(255, 255, 255, 0.55);
  }
  45% {
    transform: translateY(-6px) scale(1.08);
    background-color: #d97a12;
    box-shadow: 0 18px 28px rgba(0, 0, 0, 0.45), 0 0 16px rgba(255, 215, 130, 0.9);
  }
  55% {
    transform: translateY(-6px) scale(1.08);
    background-color: #ffb347;
    box-shadow: 0 18px 28px rgba(0, 0, 0, 0.45), 0 0 16px rgba(255, 215, 130, 0.9);
  }
}

.hints li.left2  { background-color: #db0; }
.hints li.right2 { background-color: #ee0; }
.hints li.left3, .hints li.right3 { background-color: #ac0; }
.hints li.left4, .hints li.right4 { background-color: #3bb; }
.hints li.left5, .hints li.right5 { background-color: #88f; }

/* Hide the entire number row (top row) */
#row_AE {
  display: none !important;
}

.hints li#ac01, .hints li#ac02, .hints li#ac03,
.hints li#ac08, .hints li#ac09, .hints li#ac10,
.hints li#ac04, .hints li#ac07 { /* home row */
  background-image: url(images/grid4.gif);
  font-weight: bold;
  color: white;
}


/******************************************************************************
 * Visual hints: hands picture
 */

#hands {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.25s ease;
  --anchor-x: 180px;
  --anchor-y: 120px;
  --hand-scale: 1;
  --hand-global-scale: 1.3;
}

#hands:not([data-active="true"]) span {
  transform: translate3d(-9999px, -9999px, 0);
  animation: none;
  opacity: 0;
}

.hints #hands[data-active="true"] {
  opacity: 0.9;
}

#hands span {
  position: absolute;
  top: 0;
  left: 0;
  width: 363px;
  height: 171px;
  background-image: url(images/hands.png);
  background-position: left top;
  background-size: 725px 1706px;
  transform: translate3d(calc(var(--finger-x, 332px) - var(--anchor-x)), calc(var(--finger-y, 110px) - var(--anchor-y)), 0) scale(var(--hand-global-scale, 1)) scale(var(--hand-scale));
  transform-origin: center bottom;
  animation: handsGlow 1.8s ease-in-out infinite;
  will-change: transform, filter, opacity;
}

@keyframes handsGlow {
  0%, 100% {
    opacity: 0.78;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.2)) saturate(105%);
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 20px 32px rgba(0, 0, 0, 0.35)) saturate(125%);
  }
}

#hands.left5 { --anchor-x: 46px; --anchor-y: 118px; }
#hands.left4 { --anchor-x: 94px; --anchor-y: 116px; }
#hands.left3 { --anchor-x: 138px; --anchor-y: 114px; }
#hands.left2 { --anchor-x: 182px; --anchor-y: 112px; }
#hands.thumb { --anchor-x: 210px; --anchor-y: 150px; --hand-scale: 1.05; }
#hands.right2 { --anchor-x: 242px; --anchor-y: 112px; }
#hands.right3 { --anchor-x: 286px; --anchor-y: 114px; }
#hands.right4 { --anchor-x: 328px; --anchor-y: 116px; }
#hands.right5 { --anchor-x: 356px; --anchor-y: 118px; }

#hands.left5 span { background-position: left 1537px; }
#hands.left4 span { background-position: left 1367px; }
#hands.left3 span { background-position: left 1196px; }
#hands.left2 span { background-position: left 1025px; }
#hands.thumb span { background-position: left 854px; }
#hands.right2 span { background-position: left 684px; }
#hands.right3 span { background-position: left 514px; }
#hands.right4 span { background-position: left 343px; }
#hands.right5 span { background-position: left 173px; }

#hands.shift { --hand-scale: 1.03; }

/* Static hands for non-active hand */
#staticHands {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.hints #staticHands[data-active="true"] {
  opacity: 0.7;
}

#leftHandStatic, #rightHandStatic {
  position: absolute;
  top: 0;
  left: 0;
  width: 160px;
  height: 160px;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#leftHandStatic {
  background-image: url(images/left-hand.png);
  transform: translate3d(calc(var(--left-hand-x, 0px) - 80px), calc(var(--left-hand-y, 0px) - 40px), 0) scale(calc(var(--hand-global-scale, 1.2) * 1.5), calc(var(--hand-global-scale, 1.1) * 1.1));
  transform-origin: center bottom;
}

#rightHandStatic {
  background-image: url(images/right-hand.png);
  transform: translate3d(calc(var(--right-hand-x, 0px) - 80px), calc(var(--right-hand-y, 0px) - 40px), 0) scale(calc(var(--hand-global-scale, 1.2) * 1.5), calc(var(--hand-global-scale, 1.1) * 1.1));
  transform-origin: center bottom;
}

.hints #staticHands[data-show-left="true"] #leftHandStatic {
  opacity: 1.0;
}

.hints #staticHands[data-show-right="true"] #rightHandStatic {
  opacity: 1.0;
}


#cpmErrorBox{
      position: absolute;
    top: 5px;
    right: 207px;
    height: 100px;
    width: 153px;
    border: inset 1.5px black;
    border-bottom-width: 1px;
    border-right-width: 1px;
}

/******************************************************************************
 * Keyboard settings: layout, geometry
 */

#keyboardSelector {
        margin-top: 10px;
    box-sizing: border-box;
    border-top: solid 1px #a52a2a;
    padding: 15px 0px;
    padding-left: 12px;
}

#keyboardSelector dl * {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#keyboardSelector dl dt {
    float: left;
    height: 1.5em;
    line-height: 1.5em;
    font-weight: bold;
    font-family: monospace;
    font-size: 19px;
    box-sizing: border-box;
    padding-top: 2px;
}

#keyboardSelector dl dd {
  text-align: left;
  margin-left: 210px;
  height: 37px;
  line-height: 1.5em;
}

#lesson{
      margin-top: 10px;
      display: inline-block;
}

#shape{
  margin-right: 160px !important;
}
#level{
    margin-left: 57px;
    width: 111px;
}
dl{
      margin: 0px;
      height: 97px;
    margin-top: 7px
}

select
{
    text-indent: 1em;
    width: 200px;
      height: 30px;
    position:relative;
    -webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
       -moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
            box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
}
select:before, select:after
{
    content:"";
    position:absolute;
    z-index:-1;
    -webkit-box-shadow:0 0 20px rgba(0,0,0,0.8);
    -moz-box-shadow:0 0 20px rgba(0,0,0,0.8);
    box-shadow:0 0 20px rgba(0,0,0,0.8);
    top:10px;
    bottom:10px;
    left:0;
    right:0;
    -moz-border-radius:100px / 10px;
    border-radius:100px / 10px;
}
select:after
{
    right:10px;
    left:auto;
    -webkit-transform:skew(8deg) rotate(3deg);
       -moz-transform:skew(8deg) rotate(3deg);
        -ms-transform:skew(8deg) rotate(3deg);
         -o-transform:skew(8deg) rotate(3deg);
            transform:skew(8deg) rotate(3deg);
}
select:focus{
  outline: none;
}

label[for='hints']{
  display: inline-block;
    height: 20px;
    box-sizing: border-box;
}
