:root {
  color-scheme: light;
  --bg: #171615;
  --panel: #f5f1ea;
  --paper: #fffaf2;
  --ink: #211f1c;
  --muted: #70685f;
  --line: #d3c5b2;
  --accent: #9b2f2f;
  --accent-dark: #501d1d;
  --table: #2c211a;
  --gold: #c59a50;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(20, 18, 16, 0.58), rgba(20, 18, 16, 0.78)),
    url("./assets/interview-room.png") center / cover fixed;
  color: var(--ink);
  font-family:
    "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

button {
  font: inherit;
}

.app {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  color: #fffaf2;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #d8b36f;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.05;
  letter-spacing: 0;
}

.room-note {
  max-width: 360px;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  color: #f5ead8;
  font-size: 14px;
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.28);
}

.desk {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.is-hidden {
  display: none;
}

.intro {
  position: relative;
  overflow: hidden;
  min-height: min(760px, calc(100vh - 145px));
  border: 1px solid rgba(255, 250, 242, 0.22);
  background: #111;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
}

.intro-photo,
.intro-photo img {
  width: 100%;
  height: 100%;
}

.intro-photo img {
  min-height: min(760px, calc(100vh - 145px));
  object-fit: cover;
  object-position: center;
  display: block;
}

.chat-box {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 14px;
  padding: 18px;
  color: #fffaf2;
  background: rgba(18, 14, 12, 0.82);
  border: 1px solid rgba(255, 250, 242, 0.24);
  backdrop-filter: blur(10px);
}

.bubble-log,
.interview-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble-log {
  max-height: min(360px, 44vh);
  overflow-y: auto;
  padding-right: 4px;
}

.interview-log {
  max-height: 340px;
  overflow-y: auto;
}

.bubble {
  max-width: min(680px, 88%);
  padding: 12px 14px;
  border: 1px solid rgba(255, 250, 242, 0.22);
  border-radius: 4px;
  animation: bubble-in 180ms ease-out both;
  overflow-wrap: anywhere;
  word-break: normal;
}

.bubble p {
  margin: 0;
}

.bubble .speaker {
  margin-bottom: 6px;
}

.bubble .text {
  font-size: 20px;
  line-height: 1.55;
}

.bubble.kuse {
  align-self: flex-start;
  background: rgba(12, 11, 10, 0.9);
  color: #fffaf2;
}

.bubble.aihara {
  align-self: flex-end;
  background: rgba(255, 250, 242, 0.94);
  color: #211f1c;
}

.bubble.candidate-bubble {
  align-self: center;
  background: rgba(80, 29, 29, 0.92);
  color: #fffaf2;
}

.bubble.aihara .speaker {
  color: #9b2f2f;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dialogue-actions {
  display: flex;
  gap: 10px;
}

.primary-action,
.secondary-action {
  min-width: 96px;
  border: 1px solid rgba(255, 250, 242, 0.25);
  padding: 11px 16px;
  cursor: pointer;
}

.primary-action {
  background: #fffaf2;
  color: #211f1c;
}

.secondary-action {
  background: transparent;
  color: #fffaf2;
}

.primary-action:hover,
.secondary-action:hover {
  border-color: var(--gold);
}

.candidate-list {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  background: rgba(15, 12, 10, 0.76);
  border: 1px solid rgba(255, 250, 242, 0.18);
}

.candidate {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid rgba(255, 250, 242, 0.16);
  background: rgba(255, 250, 242, 0.08);
  color: #fffaf2;
  padding: 8px;
  text-align: left;
  cursor: pointer;
}

.candidate:hover,
.candidate.is-active {
  border-color: var(--gold);
  background: rgba(197, 154, 80, 0.18);
}

.candidate.is-supported {
  border-color: rgba(255, 213, 143, 0.72);
}

.candidate.is-supported::after {
  content: "メモ済み";
  justify-self: end;
  align-self: start;
  grid-column: 2;
  color: #ffe2b0;
  font-size: 11px;
  font-weight: 900;
}

.candidate img {
  width: 62px;
  height: 78px;
  object-fit: cover;
  object-position: top;
  border: 1px solid rgba(255, 250, 242, 0.35);
}

.candidate strong,
.candidate small {
  display: block;
  overflow-wrap: anywhere;
}

.candidate strong {
  font-size: 15px;
}

.candidate small {
  margin-top: 4px;
  color: #d8d0c4;
  font-size: 12px;
  line-height: 1.35;
}

.candidate .kana {
  color: #f1c98c;
  font-size: 11px;
  font-weight: 700;
}

.interview {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 18px;
  min-height: 720px;
}

.photo-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-width: 0;
}

.photo-panel {
  position: relative;
  overflow: hidden;
  background: #111;
  border: 1px solid rgba(255, 250, 242, 0.22);
}

.photo-panel img {
  width: 100%;
  height: 100%;
  min-height: 720px;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.stamp {
  position: absolute;
  right: 16px;
  bottom: 16px;
  min-width: 112px;
  border: 2px solid var(--accent);
  color: var(--accent);
  background: rgba(255, 250, 242, 0.88);
  padding: 8px 14px;
  text-align: center;
  font-weight: 700;
  transform: rotate(-4deg);
}

.file {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(80, 29, 29, 0.08), transparent 24%),
    var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  min-width: 0;
}

.file-head {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
}

.file-head p {
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--accent-dark);
}

.file-head h2 {
  margin: 0 0 4px;
  font-size: 38px;
  letter-spacing: 0;
}

.name-kana {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 700;
}

.file-head span {
  color: var(--muted);
}

.profile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.profile div {
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.profile div:last-child {
  grid-column: 1 / -1;
}

dt {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

dd {
  margin: 4px 0 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.player-role,
.scene,
.support-note,
.memo {
  padding: 16px;
  background: rgba(33, 31, 28, 0.06);
  border-left: 4px solid var(--accent-dark);
}

.player-role {
  border-left-color: var(--gold);
  background: rgba(197, 154, 80, 0.12);
}

.player-role p:last-child {
  margin: 0;
  line-height: 1.65;
}

.support-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-left-color: var(--gold);
  background: rgba(255, 245, 231, 0.72);
}

.support-note p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.support-note button {
  flex: none;
  min-height: 48px;
  border: 1px solid var(--accent-dark);
  background: var(--ink);
  color: #fffaf2;
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
}

.support-note button:hover,
.support-note button.is-saved {
  border-color: var(--gold);
  background: var(--accent);
}

.support-note button.is-saved::before {
  content: "記録済み / ";
}

.speaker {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.scene .bubble {
  max-width: 100%;
}

.scene .bubble .text {
  font-size: 18px;
}

.scene p:last-child,
.memo p:last-child {
  margin: 0;
  font-size: 20px;
  line-height: 1.75;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice {
  min-height: 72px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.choice:hover {
  border-color: var(--accent);
  background: #fff5e7;
}

@media (max-width: 980px) {
  .interview {
    display: block;
  }

  .desk {
    display: flex;
    flex-direction: column;
  }

  .topbar {
    display: block;
  }

  .room-note {
    margin-top: 14px;
  }

  .chat-box {
    left: 14px;
    right: 14px;
    bottom: 14px;
    grid-template-columns: 1fr;
  }

  .bubble {
    max-width: 96%;
  }

  .candidate-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    margin-top: 14px;
    order: 2;
  }

  .interview {
    order: 1;
  }

  .candidate {
    min-width: 0;
  }

  .interview {
    min-height: 0;
  }

  .photo-panel img {
    min-height: 480px;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 10px;
    width: 100%;
    max-width: 100vw;
  }

  body {
    background-attachment: scroll;
  }

  h1 {
    font-size: 28px;
    line-height: 1.18;
  }

  .eyebrow {
    font-size: 12px;
  }

  .room-note {
    max-width: none;
    font-size: 13px;
  }

  .intro {
    min-height: 0;
    width: 100%;
    overflow: visible;
    background: rgba(17, 17, 17, 0.92);
  }

  .intro-photo,
  .intro-photo img {
    height: auto;
  }

  .intro-photo img {
    min-height: 0;
    aspect-ratio: 1672 / 941;
    object-fit: contain;
    object-position: center;
  }

  .chat-box {
    position: static;
    padding: 12px;
    gap: 10px;
    max-width: none;
    border-left: 0;
    border-right: 0;
  }

  .bubble-log {
    max-height: 46vh;
  }

  .bubble {
    max-width: 100%;
    padding: 10px 11px;
  }

  .candidate-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
    padding: 10px;
    max-height: none;
    width: 100%;
  }

  .candidate {
    grid-template-columns: 54px 1fr;
    gap: 9px;
  }

  .candidate img {
    width: 54px;
    height: 68px;
  }

  .candidate strong {
    font-size: 14px;
  }

  .candidate small {
    font-size: 12px;
  }

  .photo-panel img {
    width: 100%;
    min-height: 0;
    height: clamp(220px, 38vh, 340px);
  }

  .stamp {
    right: 12px;
    bottom: 12px;
    min-width: 92px;
    padding: 7px 10px;
    font-size: 14px;
  }

  .file {
    padding: 16px;
    gap: 12px;
  }

  .choices,
  .profile {
    grid-template-columns: 1fr;
  }

  .support-note {
    display: grid;
    gap: 12px;
  }

  .support-note button {
    width: 100%;
  }

  .file-head h2 {
    font-size: 29px;
    line-height: 1.2;
  }

  .scene p:last-child,
  .memo p:last-child {
    font-size: 17px;
    line-height: 1.65;
  }

  .bubble .text {
    font-size: 16px;
    line-height: 1.55;
  }

  .scene .bubble .text {
    font-size: 16px;
  }

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

  .primary-action,
  .secondary-action,
  .choice {
    min-width: 0;
    width: 100%;
  }

  .choice {
    min-height: 58px;
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 25px;
  }

  .file {
    padding: 14px;
  }
}

.inline-chat {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  background: #141012;
  border: 1px solid rgba(255, 232, 196, 0.28);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

.inline-chat.is-hidden {
  display: none;
}

.inline-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px 6px 12px;
  color: #fff3dd;
  background: rgba(23, 18, 18, 0.94);
}

.inline-chat-head p {
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

.inline-chat-head strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.inline-chat-head a {
  flex: none;
  padding: 6px 8px;
  color: #ffe2b0;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 232, 196, 0.28);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.inline-chat-head a:hover {
  background: rgba(255, 232, 196, 0.16);
}

.inline-chat iframe {
  display: block;
  width: 100%;
  min-width: 0;
  height: 390px;
  background: #14181c;
  border: 0;
}

@media (max-width: 720px) {
  .inline-chat {
    margin-bottom: 12px;
    width: 100%;
  }

  .inline-chat-head strong {
    font-size: 12px;
  }

  .inline-chat-head a {
    padding: 6px 7px;
    font-size: 11px;
  }

  .inline-chat iframe {
    height: clamp(330px, 44vh, 420px);
  }
}

@media (max-width: 380px) {
  .photo-panel img {
    height: clamp(190px, 34vh, 260px);
  }

  .inline-chat iframe {
    height: clamp(310px, 42vh, 380px);
  }
}
