:root {
  color-scheme:dark;
  --gold:#f5ce83;
  --art:url('./assets/reference-art.webp');
  --portraits:url('./assets/mentor-portraits-hd.webp');
  font-family:Arial,'Yu Gothic','Meiryo',sans-serif;
  background:#050504;
  color:#f0e9dc
}

* {
  box-sizing:border-box
}

body {
  margin:0
}

button {
  font:inherit;
  cursor:pointer
}

button:focus-visible,a.nav-item:focus-visible {
  outline:3px solid #fff0c4;
  outline-offset:5px
}

button:disabled {
  cursor:default
}

.stage-wrap {
  width:100%;
  aspect-ratio:16/9;
  margin:0 auto;
  overflow:hidden
}

.stage {
  width:1280px;
  height:720px;
  position:relative;
  background:var(--art) center/1280px 720px no-repeat;
  transform:scale(var(--scale,1));
  transform-origin:top left
}

/* The supplied artwork retains the original ornate heading. */
.masthead h1 {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
  margin:0
}


/* Show only the banner band within the generated image's white canvas. */
.masthead h2 {
  position:absolute;
  left:454px;
  top:101px;
  width:371px;
  height:45px;
  margin:0;
  overflow:hidden;
  text-indent:-9999px;
  border-radius:8px;
  background:url('./assets/title-hd.webp') center 45%/100% 247.484% no-repeat
}

.mentors {
  position:absolute;
  left:293px;
  top:153px;
  width:700px;
  min-height:calc(70px * 5 + 6px * 4);
  list-style:none;
  padding:0;
  margin:0;
  display:grid;
  background:#050504;
  gap:6px
}

.mentor {
  height:70px;
  border:1px solid #59452b;
  border-right-color:#252017;
  border-bottom-color:#332b20;
  border-radius:14px;
  display:grid;
  grid-template-columns:86px 112px 225px 99px 1fr;
  align-items:center;
  background:linear-gradient(104deg,#3b2b18 0%,#2b2218 29%,#1d1912 65%,#100f0b 100%);
  box-shadow:inset 0 1px 1px #c79c6533;
  position:relative;
  padding:0 20px
}

.rank {
  font-size:40px;
  font-weight:700;
  letter-spacing:-1px;
  color:#ffe09a;
  text-shadow:0 1px 2px #a76520
}

.portrait {
  display:block;
  width:72px;
  height:68px;
  background-image:var(--portraits);
  background-size:auto 340px;
  background-repeat:no-repeat;
  align-self:end;
  justify-self:start;
  mask-image:linear-gradient(90deg,transparent,#000 9%,#000 91%,transparent)
}

.portrait-1 {
  background-position:center 0%
}

.portrait-2 {
  background-position:center 25%
}

.portrait-3 {
  background-position:center 50%
}

.portrait-4 {
  background-size:auto 353px;
  background-position:center -211px
}

.portrait-5 {
  background-position:center 100%
}

.name {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:25px;
  font-weight:400;
  letter-spacing:.3px;
  color:#f4f1e9;
  white-space:nowrap
}

.votes {
  display:flex;
  align-items:baseline;
  justify-content:flex-end;
  gap:7px;
  padding-right:11px;
  color:#ffdfa0;
  white-space:nowrap
}

.votes strong {
  font-size:25px;
  letter-spacing:1px
}

.votes>span {
  font-size:18px
}

.vote {
  justify-self:end;
  width:110px;
  height:40px;
  border-radius:24px;
  border:1px solid #dba756;
  color:#ffe094;
  background:radial-gradient(ellipse at 74% 105%,#e99d284a 0%,transparent 34%),linear-gradient(#201c10,#060706 58%,#110e07);
  box-shadow:inset 0 1px 2px #fff3c5,0 0 1px #a9803d;
  font-size:22px;
  line-height:1;
  font-weight:700;
  transition:filter .15s,box-shadow .15s,transform .15s
}

.vote:hover {
  filter:brightness(1.3);
  box-shadow:inset 0 1px 2px #fff3c5,0 0 14px #e0ab424f
}

.vote:active {
  transform:translateY(1px)
}

.vote:disabled {
  color:#bba577;
  border-color:#877049;
  box-shadow:none
}

.mentor.is-selected {
  border-color:#e0b66b
}

.mentor.is-selected .vote {
  color:#ffe3a5;
  background:#463219;
  font-size:18px
}

.navigation {
  position:absolute;
  left:123px;
  top:545px;
  width:1033px;
  height:138px;
  border-radius:14px;
  background:linear-gradient(110deg,#0d0c08,#090a07 52%,#100e09);
  display:grid;
  grid-template-columns:repeat(4,1fr);
  overflow:visible
}

.nav-item {
  position:relative;
  padding:9px 3px 5px;
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  border:0;
  background:none;
  color:#edc580;
  transition:background .2s
}

a.nav-item {
  text-decoration:none;
  color:#edc580;
  cursor:pointer;
  font:inherit
}

.nav-item+.nav-item:before {
  content:'';
  position:absolute;
  left:0;
  top:17px;
  height:105px;
  width:1px;
  background:linear-gradient(#8b6632,#bd914f,#654820)
}

.nav-item:first-child {
  border-radius:14px 0 0 14px
}

.nav-item:last-child {
  border-radius:0 14px 14px 0
}

.nav-item:hover {
  background:#e4b6680d
}

.nav-item:active {
  transform:scale(.98)
}

.nav-icon {
  width:58px;
  height:54px;
  flex:none;
  filter:drop-shadow(1px 2px 1px #000)
}

.nav-icon svg {
  display:block;
  width:100%;
  height:100%;
  overflow:visible;
  pointer-events:none
}

.nav-icon__metal {
  stroke:#fff0bb;
  stroke-width:.65
}

.nav-icon__shine {
  fill:none;
  stroke:#fff8dc;
  stroke-width:2;
  stroke-linecap:round;
  opacity:.8
}

.nav-icon__cup,
.nav-icon__gift-lid,
.nav-icon__growth-arrow,
.nav-icon__wheel-disc {
  transform-box:view-box
}

.nav-icon__cup {
  transform-origin:50% 70.3125%
}

.nav-icon__gift-lid {
  transform-origin:50% 42.1875%
}

.nav-icon__growth-arrow {
  transform-origin:50% 50%
}

.nav-icon__wheel-disc {
  transform-origin:50% 48.4375%
}

@keyframes nav-icon-wiggle {
  25% {
    transform:rotate(-4deg)
  }

  75% {
    transform:rotate(4deg)
  }
}

@keyframes nav-icon-lid {
  40% {
    transform:translateY(-4px) rotate(-6deg)
  }
}

@keyframes nav-icon-arrow {
  40% {
    transform:translateY(-3px)
  }
}

@keyframes nav-icon-spin {
  45% {
    transform:rotate(45deg)
  }
}

@media (hover:hover) and (pointer:fine) {
  .nav-item:hover .nav-icon__cup {
    animation:nav-icon-wiggle .5s ease-in-out
  }

  .nav-item:hover .nav-icon__gift-lid {
    animation:nav-icon-lid .5s ease-in-out
  }

  .nav-item:hover .nav-icon__growth-arrow {
    animation:nav-icon-arrow .4s ease-out
  }

  .nav-item:hover .nav-icon__wheel-disc {
    animation:nav-icon-spin .55s ease-in-out
  }
}

.nav-item:focus-visible .nav-icon__cup {
  animation:nav-icon-wiggle .5s ease-in-out
}

.nav-item:focus-visible .nav-icon__gift-lid {
  animation:nav-icon-lid .5s ease-in-out
}

.nav-item:focus-visible .nav-icon__growth-arrow {
  animation:nav-icon-arrow .4s ease-out
}

.nav-item:focus-visible .nav-icon__wheel-disc {
  animation:nav-icon-spin .55s ease-in-out
}

.nav-title {
  font-size:28px;
  font-weight:700;
  line-height:36px;
  white-space:nowrap;
  letter-spacing:-.5px
}

@font-face {
  font-family:'Noto Sans JP Nav';
  src:url('./assets/noto-sans-jp-nav.woff2') format('woff2');
  font-weight:400;
  font-display:swap
}

.nav-description {
  width:100%;
  font-size:15px;
  line-height:16px;
  font-weight:400;
  text-align:center;
  font-family:'Noto Sans JP Nav',Meiryo,'Yu Gothic',sans-serif
}

.preview-note {
  padding:12px 20px 16px;
  text-align:center;
  color:#a89d86;
  font-size:12px;
  line-height:1.8;
  border-top:1px solid #d2a5501a;
  background:#080806
}

.load-error {
  position:fixed;
  inset:0;
  z-index:30;
  display:grid;
  place-items:center;
  align-content:center;
  gap:16px;
  background:#050504f2;
  color:#f2d59e;
  text-align:center;
  padding:24px
}

.load-error p {
  margin:0;
  font-size:16px
}

.load-error button {
  min-height:44px;
  padding:8px 24px;
  border-radius:24px;
  border:1px solid #f3d18a;
  background:linear-gradient(#ffe0a0,#c68d3e);
  color:#261b0c;
  font-weight:700
}

dialog {
  width:min(440px,calc(100% - 32px));
  padding:32px;
  border:1px solid #a87e3e;
  border-radius:16px;
  background:radial-gradient(ellipse at top,#302619,#0e0d0a 80%);
  color:#eee5d5;
  box-shadow:0 20px 100px #000a
}

dialog::backdrop {
  background:#000b;
  backdrop-filter:blur(5px)
}

.close-dialog {
  position:absolute;
  right:12px;
  top:8px;
  background:none;
  color:#b8a683;
  border:0;
  font-size:28px;
  padding:4px 8px
}

.dialog-eyebrow {
  color:#bf9758;
  font-size:11px;
  letter-spacing:3px
}

dialog h2 {
  font-size:24px;
  line-height:1.5;
  color:#f5d092;
  margin:18px 0 12px
}

dialog p {
  font-size:15px;
  line-height:1.9;
  margin:0 0 26px;
  white-space:pre-line;
  color:#cbc1af
}

.dialog-actions {
  display:flex;
  gap:12px;
  justify-content:flex-end
}

.dialog-actions button {
  min-height:44px;
  border-radius:24px;
  padding:9px 24px
}

#preview-dialog #dialog-description {
  overflow-wrap:anywhere
}

#edit-line-nickname {
  margin-bottom:12px;
  padding:8px 12px
}

.secondary-action {
  border:1px solid #6d5838;
  background:transparent;
  color:#dfcba6
}

.primary-action {
  border:1px solid #f3d18a;
  background:linear-gradient(#ffe0a0,#c68d3e);
  color:#261b0c;
  font-weight:700
}

#vote-success-dialog {
  box-sizing:border-box;
  width:min(440px,calc(100% - 32px));
  max-height:calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin:auto;
  padding:32px;
  overflow-y:auto;
  border:1px solid #a87e3e;
  border-radius:16px;
  background:radial-gradient(ellipse at top,#302619,#0e0d0a 80%);
  color:#eee5d5
}

#vote-success-dialog::backdrop {
  background:rgb(0 0 0 / 28%);
  -webkit-backdrop-filter:blur(6px);
  backdrop-filter:blur(6px)
}

#vote-success-message {
  margin:0;
  font-size:16px;
  line-height:1.9;
  white-space:normal;
  line-break:strict;
  overflow-wrap:anywhere
}

#vote-success-message strong {
  color:#f5d092;
  white-space:nowrap
}

.vote-success-days {
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  justify-content:space-between;
  gap:8px 16px;
  margin:22px 0 24px;
  padding:16px;
  border:1px solid #a87e3e55;
  border-radius:10px;
  background:#d7aa5810
}

.vote-success-total {
  color:#f5d092;
  white-space:nowrap
}

#vote-success-count {
  margin-right:7px;
  font-size:34px;
  font-weight:700;
  font-variant-numeric:tabular-nums
}

#vote-success-dialog .close-dialog {
  min-width:44px;
  min-height:44px
}

@media (max-width:480px) {
  #vote-success-dialog {
    padding:28px 22px 22px
  }

  #vote-success-dialog h2 {
    font-size:22px
  }

  #vote-success-dialog .primary-action {
    width:100%;
    min-height:48px
  }
}

#line-dialog {
  width:min(440px,calc(100% - 32px));
  max-height:calc(100svh - 32px);
  overflow-y:auto;
  margin:auto;
  padding:32px;
  border:1px solid #ac854b;
  border-radius:18px;
  background:radial-gradient(ellipse at top,#34291c,#12100d 80%);
  color:#eee5d5;
  box-shadow:0 24px 100px #000a
}

#line-dialog::backdrop {
  background:#0006;
  backdrop-filter:blur(7px);
  -webkit-backdrop-filter:blur(7px)
}

#line-dialog h2 {
  margin:0 0 12px;
  font-size:24px;
  line-height:1.5;
  color:#f5d092
}

#line-dialog p {
  font-size:14px;
  line-height:1.9;
  color:#c7bdad;
  margin:0 0 24px
}

#line-name {
  display:block;
  width:100%;
  height:52px;
  padding:12px 14px;
  border:1px solid #736044;
  border-radius:9px;
  background:#09080799;
  color:#fff1d8;
  font:inherit;
  font-size:16px;
  outline:none
}

#line-name:focus {
  border-color:#e5bd77;
  box-shadow:0 0 0 3px #e5bd771a
}

#line-name::placeholder {
  color:#867b6b
}

#line-error {
  min-height:22px;
  margin-top:6px;
  color:#ffb4a5;
  font-size:12px
}

#line-dialog .line-actions {
  display:flex;
  gap:12px;
  margin-top:18px
}

#line-dialog button {
  min-height:48px;
  white-space:nowrap;
  border-radius:9px;
  padding:10px 16px;
  font:inherit;
  font-size:14px
}

#line-cancel {
  flex:1;
  border:1px solid #655339;
  background:transparent;
  color:#c8bca7
}

#line-next {
  flex:1.6;
  border:1px solid #f1cf8b;
  background:linear-gradient(135deg,#ffe2a5,#c99548);
  color:#2b1e0d;
  font-weight:700
}

#line-next:disabled {
  cursor:not-allowed;
  opacity:.4
}

@media (max-width:480px) {
  #line-dialog {
    padding:26px 22px 22px
  }

  #line-dialog h2 {
    font-size:22px
  }
}

[hidden] {
  display:none!important
}

.toast {
  position:fixed;
  left:50%;
  bottom:25px;
  transform:translate(-50%,15px);
  opacity:0;
  pointer-events:none;
  width:max-content;
  max-width:calc(100% - 32px);
  padding:15px 24px;
  text-align:center;
  line-height:1.5;
  border:1px solid #b98f4a;
  border-radius:12px;
  background:#17130cf5;
  color:#f2d59e;
  font-size:14px;
  box-shadow:0 8px 30px #0008;
  transition:opacity .2s,transform .2s
}

.toast.is-error {
  color:#ff6b6b;
}

.toast.visible {
  opacity:1;
  transform:translate(-50%,0)
}

@media(max-width:700px) {
  .stage-wrap {
    width:100%;
    aspect-ratio:auto;
    overflow:visible
  }

  .stage {
    width:100%;
    height:auto;
    min-height:100svh;
    transform:none;
    background:radial-gradient(ellipse at 50% 0%,#60411e88,transparent 42%),#070806;
    padding:30px 16px 22px
  }

  .masthead {
    position:relative;
    text-align:center;
    margin-bottom:25px
  }

  .masthead:before {
    content:'';
    position:absolute;
    top:-30px;
    left:-16px;
    right:-16px;
    height:5px;
    background:linear-gradient(90deg,#70421b,#ffe8ac,#70421b);
    box-shadow:0 0 28px #efc56670
  }

  .masthead h1 {
    position:static;
    width:auto;
    height:auto;
    overflow:visible;
    clip-path:none;
    white-space:normal
  }

  .masthead h1 {
    font-size:clamp(21px,5.2vw,33px);
    line-height:1.65;
    font-weight:800;
    color:#f6cf81;
    text-wrap:balance;
    text-shadow:0 2px 14px #bd7a2844
  }

  .masthead h2 {
    position:relative;
    left:auto;
    top:auto;
    width:min(100%,371px);
    height:auto;
    aspect-ratio:371/45;
    margin:18px auto 0
  }

  .mentors {
    position:static;
    width:100%;
    min-height:calc(82px * 5 + 10px * 4);
    gap:10px
  }

  .mentor {
    height:82px;
    padding:0 12px;
    grid-template-columns:34px 56px minmax(0,1fr) 56px;
    grid-template-rows:1fr 1fr;
    column-gap:7px;
    border-radius:12px
  }

  .rank {
    font-size:25px;
    grid-row:1/3
  }

  .portrait {
    grid-row:1/3;
    width:56px;
    height:68px;
    align-self:center
  }

  .name {
    grid-column:3;
    grid-row:1;
    font-size:clamp(16px,4.1vw,22px);
    align-self:end;
    padding-bottom:2px;
    letter-spacing:0
  }

  .votes {
    grid-column:3;
    grid-row:2;
    justify-content:flex-start;
    align-self:start;
    padding:3px 0 0;
    gap:5px
  }

  .votes strong {
    font-size:18px
  }

  .votes>span {
    font-size:13px
  }

  .vote {
    grid-column:4;
    grid-row:1/3;
    width:56px;
    height:36px;
    font-size:16px
  }

  .mentor.is-selected .vote {
    font-size:12px
  }

  .navigation {
    position:static;
    width:100%;
    height:auto;
    margin-top:24px;
    border:1px solid #a07a40;
    grid-template-columns:repeat(2,minmax(0,1fr));
    border-radius:14px;
    background:linear-gradient(110deg,#171109,#090a07)
  }

  .nav-item {
    min-height:137px;
    padding:12px 2px
  }

  .nav-item:first-child {
    border-radius:14px 0 0 0
  }

  .nav-item:nth-child(2) {
    border-radius:0 14px 0 0
  }

  .nav-item:nth-child(3) {
    border-radius:0 0 0 14px
  }

  .nav-item:last-child {
    border-radius:0 0 14px 0
  }

  .nav-item+.nav-item:before {
    display:none
  }

  .nav-item:nth-child(even) {
    border-left:1px solid #75562f
  }

  .nav-item:nth-child(n+3) {
    border-top:1px solid #75562f
  }

  .nav-title {
    font-size:clamp(16px,4.1vw,23px);
    line-height:32px;
    letter-spacing:-.5px
  }

  .nav-description {
    font-size:12px;
    line-height:16px
  }

  .preview-note {
    font-size:11px;
    padding:12px 22px
  }

  .toast {
    bottom:16px
  }

}

@media(prefers-reduced-motion:reduce) {
  * {
    transition:none!important
  }

  .nav-icon__cup,
  .nav-icon__gift-lid,
  .nav-icon__growth-arrow,
  .nav-icon__wheel-disc {
    animation:none!important
  }

  .nav-item:active {
    transform:none
  }

}

.portrait.custom-portrait  {
  background: #261e14;
  mask-image: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  font-size: 12px;
  color: #c7b58e;
  text-align: center;
}

.custom-portrait img  {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
