@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700;800;900&family=Noto+Sans+JP:wght@500;600;700;800;900&display=swap");

:root {
  --u30-green: #078542;
  --u30-green-dark: #064b2c;
  --u30-blue: #1f62d1;
  --u30-orange: #ff7618;
  --u30-pink: #eb2778;
  --u30-yellow: #f5d631;
  --paper: #f4f2e9;
  --paper-bright: #fffef9;
  --ink: #151d1a;
  --muted: #5f6963;
  --line: #18211d;
  --radius: 8px;
  --shadow: 8px 8px 0 rgba(8, 57, 31, .2);
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: #dfe8df;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #dfe8df;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px),
    #dfe8df;
  background-size: 32px 32px;
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  touch-action: manipulation;
}

.app {
  display: grid;
  grid-template-columns: minmax(460px, .93fr) minmax(520px, 1.07fr);
  min-height: 100dvh;
  max-width: 1540px;
  margin: 0 auto;
  border-inline: 2px solid rgba(21, 29, 26, .18);
  background: var(--paper);
}

aside {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
  isolation: isolate;
  background-color: var(--u30-green);
  background-image:
    linear-gradient(90deg, rgba(4, 48, 26, .16), transparent 52%),
    url("assets/u30-street-court-bg.png");
  background-size: cover;
  background-position: 42% center;
}

aside::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(5, 64, 33, .08) 0 38%, rgba(4, 54, 29, .74) 72% 100%);
  content: "";
  pointer-events: none;
}

aside::after {
  position: absolute;
  inset: auto -120px 45% auto;
  z-index: -1;
  width: 440px;
  height: 82px;
  border: 3px solid rgba(255, 255, 255, .55);
  content: "";
  transform: rotate(-8deg);
  pointer-events: none;
}

.brand {
  position: relative;
  display: block;
  min-height: 350px;
  margin-bottom: 18px;
  padding: 18px 18px 16px;
  color: #fff;
}

.brand > div.brand-copy:last-child {
  position: relative;
  z-index: 2;
  width: min(100%, 620px);
  margin: 0 !important;
  padding-top: 72px;
}

.brand-mark {
  position: relative;
  inset: auto;
  display: block;
  width: min(100%, 560px);
  height: 246px;
  margin: 0;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 10px 10px 0 rgba(7, 39, 24, .4);
  background: #252724;
  transform: rotate(-1.1deg);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.lead {
  max-width: 52ch;
  margin: 16px 0 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.65;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .16);
}

.u30-strip {
  display: flex;
  width: 100%;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.u30-strip::-webkit-scrollbar {
  display: none;
}

.u30-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  color: var(--ink);
  background: var(--paper-bright);
  box-shadow: 3px 3px 0 var(--u30-orange);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.brand-characters {
  position: absolute;
  top: 8px;
  right: -8px;
  left: auto;
  z-index: 3;
  display: flex;
  width: 190px;
  height: 62px;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.brand-character {
  position: absolute;
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(4px 5px 0 rgba(5, 48, 27, .28));
}

.brand-character:nth-child(1) {
  top: 0;
  right: 126px;
  transform: rotate(-10deg);
}

.brand-character:nth-child(2) {
  top: 0;
  right: 63px;
  transform: rotate(3deg);
}

.brand-character:nth-child(3) {
  top: 0;
  right: 0;
  transform: rotate(9deg);
}

.entry-sheet {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin-top: auto;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 12px 12px 0 rgba(5, 52, 28, .35);
  background: var(--paper-bright);
  overflow: hidden;
}

.panel {
  margin: 0;
  padding: 20px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.input-panel {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 8px 12px;
  align-items: end;
}

.sheet-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 2px;
}

.sheet-heading span {
  color: var(--u30-pink);
  font-size: 11px;
  font-weight: 900;
}

.sheet-heading h2,
.panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.15;
}

.input-panel > label[for="playerName"] {
  grid-column: 1;
}

#playerName {
  grid-column: 1;
}

.input-panel > label[for="playerPhoto"] {
  grid-column: 1 / -1;
}

.drop {
  grid-column: 1 / -1;
}

.input-panel > label[for="genderTone"] {
  grid-column: 2;
  grid-row: 2;
}

#genderTone {
  grid-column: 2;
  grid-row: 3;
}

.input-panel label:not(.drop) {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.input-panel input,
.input-panel select {
  width: 100%;
  min-width: 0;
  height: 48px;
  margin: 0;
  padding: 0 13px;
  border: 2px solid var(--line);
  border-radius: 4px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  transition: transform .22s cubic-bezier(.16, 1, .3, 1), box-shadow .22s cubic-bezier(.16, 1, .3, 1);
}

.input-panel input:focus,
.input-panel select:focus {
  box-shadow: 4px 4px 0 var(--u30-blue);
  transform: translate(-1px, -1px);
}

.drop {
  position: relative;
  display: grid;
  min-height: 86px;
  grid-template-columns: 54px 1fr;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 1px 12px;
  margin: 0;
  padding: 10px 14px;
  overflow: hidden;
  border: 2px dashed var(--u30-green);
  border-radius: 4px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(210, 232, 35, .22), rgba(31, 98, 209, .08)),
    #fff;
  cursor: pointer;
  transition: transform .22s cubic-bezier(.16, 1, .3, 1), box-shadow .22s cubic-bezier(.16, 1, .3, 1);
}

.drop:hover {
  box-shadow: 5px 5px 0 rgba(31, 98, 209, .42);
  transform: translate(-1px, -1px);
}

.drop:active,
.btn:active {
  transform: translateY(1px) scale(.985);
}

.drop img {
  position: absolute;
  inset: 0 auto 0 0;
  width: 90px;
  height: 100%;
  object-fit: cover;
  border-right: 2px solid var(--line);
}

.drop img:not([hidden]) ~ .upload-plus {
  opacity: 0;
}

.drop img:not([hidden]) ~ strong,
.drop img:not([hidden]) ~ span:last-child {
  margin-left: 74px;
}

.upload-plus {
  grid-row: 1 / 3;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  align-self: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: #fff;
  background: var(--u30-green);
  font-size: 31px;
  font-weight: 600;
  line-height: 1;
}

.drop strong {
  align-self: end;
  font-size: 16px;
  font-weight: 900;
}

.drop > span:last-child {
  align-self: start;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.note {
  grid-column: 1 / -1;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.55;
}

.generate-panel {
  padding: 0 20px 18px;
}

.actions {
  display: grid;
  gap: 10px;
}

.btn {
  min-height: 50px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 4px;
  color: #fff;
  background: var(--u30-green);
  box-shadow: 5px 5px 0 var(--line);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .22s cubic-bezier(.16, 1, .3, 1), box-shadow .22s cubic-bezier(.16, 1, .3, 1);
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--line);
}

.btn.hot {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding-inline: 19px 11px;
  border-color: var(--line);
  color: #fff;
  background: var(--u30-pink);
  box-shadow: 6px 6px 0 var(--line);
  font-size: 16px;
}

.button-arrow {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: var(--line);
  background: var(--u30-yellow);
  font-size: 21px;
  line-height: 1;
}

.privacy-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
}

.connection-alert {
  position: relative;
  z-index: 4;
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--u30-yellow);
  font-size: 12px;
  font-weight: 800;
}

.connection-alert.show {
  display: block;
}

main {
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(7, 133, 66, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 133, 66, .08) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

.stage {
  width: min(100%, 740px);
  padding: 0;
  border: 0;
  background: transparent;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.toolbar h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
}

.status {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid rgba(21, 29, 26, .28);
  border-radius: 4px;
  color: var(--u30-green-dark);
  background: rgba(255, 255, 255, .76);
  font-size: 10px;
  font-weight: 800;
}

.spinner {
  display: none;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 2px solid rgba(7, 133, 66, .25);
  border-top-color: var(--u30-green);
  border-radius: 50%;
}

.status.loading .spinner {
  display: inline-block;
  animation: status-spin .7s linear infinite;
}

.preview-wrap {
  position: relative;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, .78);
}

#reportCanvas,
#reportExportMirror {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 2px;
  background: var(--u30-green-dark);
}

#reportExportMirror[hidden] {
  display: none;
}

.result-actions {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

body.result-mode .result-actions {
  display: grid;
}

.result-actions .btn {
  min-height: 52px;
}

.result-actions .btn.hot {
  justify-content: center;
  grid-column: 1 / -1;
}

.result-actions .secondary {
  color: var(--ink);
  background: #fff;
}

.result-actions .wide {
  grid-column: 1 / -1;
}

.result-only {
  display: none !important;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 20px;
  background-color: var(--u30-green-dark);
  background-image:
    linear-gradient(180deg, rgba(3, 32, 18, .18), rgba(3, 32, 18, .72)),
    url("assets/u30-street-court-bg.png");
  background-size: cover;
  background-position: center;
}

.loading-overlay[hidden] {
  display: none;
}

.loading-card {
  position: relative;
  display: grid;
  width: min(92vw, 520px);
  justify-items: center;
  padding: 16px 18px 0;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 12px 12px 0 rgba(11, 20, 15, .7);
  background: var(--paper-bright);
}

.loading-logo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  margin: 0 0 4px;
  border: 2px solid var(--line);
  border-radius: 4px;
  object-fit: contain;
  background: #252724;
}

.loading-character {
  width: 230px;
  height: 184px;
  margin: -6px 0 -8px;
}

.loading-meter {
  width: min(100%, 380px);
  height: 12px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 2px;
  background: #fff;
}

.loading-meter span {
  display: block;
  width: 42%;
  height: 100%;
  background: var(--u30-pink);
  animation: loading-travel 1.2s cubic-bezier(.16, 1, .3, 1) infinite alternate;
}

.loading-dots {
  margin-top: 14px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 900;
}

.loading-dots::after {
  display: inline-block;
  width: 1.4em;
  content: "...";
  animation: dots 1.2s steps(4, end) infinite;
  overflow: hidden;
  vertical-align: bottom;
}

#loadingText {
  min-height: 42px;
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
}

.loading-band {
  display: block;
  width: calc(100% + 36px);
  height: 48px;
  object-fit: cover;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 4px;
  color: #fff;
  background: var(--ink);
  box-shadow: 5px 5px 0 var(--u30-orange);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .22s ease, transform .22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes loading-travel {
  from { transform: translateX(-105%); }
  to { transform: translateX(245%); }
}

@keyframes dots {
  from { width: 0; }
  to { width: 1.4em; }
}

@keyframes status-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1040px) {
  .app {
    grid-template-columns: minmax(410px, .9fr) minmax(460px, 1.1fr);
  }

  aside,
  main {
    padding: 18px;
  }

  .brand {
    min-height: 316px;
    padding: 10px;
  }

  .brand > div.brand-copy:last-child {
    padding-top: 96px;
  }

  .brand-mark {
    height: 216px;
  }

  .brand-character {
    width: 84px;
    height: 84px;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--paper);
  }

  .app {
    display: block;
    min-height: 100dvh;
    border: 0;
  }

  aside {
    min-height: 100dvh;
    padding: 0 12px 14px;
    background-position: 38% top;
  }

  aside::after {
    display: none;
  }

  .brand {
    min-height: 346px;
    margin: 0;
    padding: 12px 2px 14px;
  }

  .brand > div.brand-copy:last-child {
    padding-top: 52px;
  }

  .brand-mark {
    width: 100%;
    height: 194px;
    box-shadow: 6px 6px 0 rgba(7, 39, 24, .4);
  }

  .lead {
    margin: 10px 2px 8px;
    font-size: 12px;
    line-height: 1.5;
  }

  .u30-strip {
    padding-bottom: 3px;
  }

  .u30-chip {
    padding: 4px 6px;
    box-shadow: 2px 2px 0 var(--u30-orange);
    font-size: 9px;
  }

  .brand-characters {
    top: 2px;
    right: 0;
    left: auto;
    width: 132px;
    height: 44px;
  }

  .brand-character {
    width: 42px;
    height: 42px;
  }

  .brand-character:nth-child(1) {
    top: 0;
    right: 88px;
  }

  .brand-character:nth-child(2) {
    top: 0;
    right: 44px;
  }

  .brand-character:nth-child(3) {
    top: 0;
    right: 0;
  }

  .entry-sheet {
    margin-top: -8px;
    box-shadow: 7px 7px 0 rgba(5, 52, 28, .32);
  }

  .panel {
    padding: 12px;
  }

  .input-panel {
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 5px 8px;
  }

  .sheet-heading {
    margin-bottom: 0;
  }

  .sheet-heading h2 {
    font-size: 18px;
  }

  .sheet-heading span {
    font-size: 8px;
  }

  .input-panel label:not(.drop) {
    font-size: 10px;
  }

  .input-panel input,
  .input-panel select {
    height: 40px;
    padding-inline: 9px;
    font-size: 12px;
  }

  .drop {
    min-height: 62px;
    grid-template-columns: 39px 1fr;
    gap: 0 9px;
    padding: 6px 9px;
  }

  .drop img {
    width: 70px;
  }

  .drop img:not([hidden]) ~ strong,
  .drop img:not([hidden]) ~ span:last-child {
    margin-left: 58px;
  }

  .upload-plus {
    width: 34px;
    height: 34px;
    font-size: 23px;
  }

  .drop strong {
    font-size: 13px;
  }

  .drop > span:last-child {
    font-size: 9px;
  }

  .note {
    font-size: 9px;
    line-height: 1.45;
  }

  .generate-panel {
    padding: 0 12px 11px;
  }

  .btn.hot {
    min-height: 48px;
    padding: 7px 7px 7px 14px;
    box-shadow: 4px 4px 0 var(--line);
    font-size: 14px;
  }

  .button-arrow {
    width: 31px;
    height: 31px;
    font-size: 18px;
  }

  .privacy-note {
    margin-top: 7px;
    font-size: 8px;
  }

  .connection-alert {
    margin: -4px 0 10px;
    font-size: 10px;
  }

  main {
    display: none;
    min-height: 100dvh;
    padding: 12px 10px 24px;
  }

  body.result-mode aside {
    display: none;
  }

  body.result-mode main {
    display: grid;
  }

  .toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -12px -10px 10px;
    padding: 10px 12px;
    border-bottom: 2px solid var(--line);
    background: rgba(244, 242, 233, .96);
    backdrop-filter: blur(10px);
  }

  .toolbar h2 {
    font-size: 15px;
  }

  .status {
    max-width: 58%;
    font-size: 8px;
  }

  .preview-wrap {
    padding: 7px;
    box-shadow: 6px 6px 0 rgba(8, 57, 31, .2);
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .result-actions .btn,
  .result-actions .btn.hot,
  .result-actions .wide {
    grid-column: auto;
  }

  .loading-card {
    width: min(94vw, 420px);
    padding: 10px 10px 0;
    box-shadow: 7px 7px 0 rgba(11, 20, 15, .7);
  }

  .loading-logo {
    height: auto;
  }

  .loading-character {
    width: 194px;
    height: 150px;
  }

  .loading-dots {
    margin-top: 10px;
    font-size: 18px;
  }

  #loadingText {
    font-size: 10px;
  }
}

@media (max-width: 380px), (max-height: 720px) and (max-width: 760px) {
  .brand {
    min-height: 334px;
  }

  .brand > div.brand-copy:last-child {
    padding-top: 72px;
  }

  .brand-mark {
    height: 162px;
  }

  .lead {
    margin-top: 8px;
    font-size: 11px;
  }

  .brand-character {
    width: 61px;
    height: 61px;
  }

  .input-panel {
    gap-block: 4px;
  }

  .drop {
    min-height: 56px;
  }

  .note,
  .privacy-note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
