:root {
  --bg: #101419;
  --panel: #151b22;
  --panel-border: #263244;
  --accent: #ffcc66;
  --accent-soft: rgba(255, 204, 102, 0.15);
  --text: #e6edf3;
  --muted: #9fb0c0;
  --bubble: #1d2530;
  --bubble-border: #2b384a;
  --shadow: rgba(0, 0, 0, 0.25);
  --font-display: "Manrope", "Noto Sans JP", sans-serif;
  --font-body: "Manrope", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: radial-gradient(circle at top left, #1b2230, #0e1218 60%);
  color: var(--text);
  min-height: 100vh;
  width: 100vw;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.en {
  font-family: "Manrope", "Noto Sans JP", sans-serif;
}

.ja {
  font-family: "Noto Sans JP", "Manrope", sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  width: min(92vw, 1000px);
  aspect-ratio: 16 / 9;
  max-height: 90vh;
  gap: 16px;
  padding: 24px;
  margin: 0;
  align-items: center;
}

.app__header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.app__header-brand {
  color: #c9d1d9;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.app__header-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #3b414a;
  color: #e6edf3;
  font-size: 10px;
}

.app__main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
  justify-items: center;
  width: 100%;
}

.character {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  background: linear-gradient(160deg, #151c26, #0d1218 65%);
  border: 1px solid var(--panel-border);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 18px 45px var(--shadow);
  cursor: pointer;
  margin: 0 auto;
}

.character__name {
  position: absolute;
  top: 18px;
  left: 20px;
  font-size: 14px;
  color: #d9e1ea;
  text-transform: lowercase;
  letter-spacing: 0.4px;
  z-index: 3;
}

.character__halo {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 204, 102, 0.25), rgba(255, 204, 102, 0) 70%);
  filter: blur(2px);
  animation: haloPulse 6s ease-in-out infinite;
}

.character__controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
  pointer-events: auto;
}

.control-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: #1a222d;
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  pointer-events: auto;
}

.control-btn__icon {
  width: 18px;
  height: 18px;
  display: block;
}

.control-btn:hover {
  transform: translateY(-2px);
  border-color: #ffffff;
  background: #2a3340;
}

.control-btn.is-muted {
  opacity: 0.4;
  pointer-events: none;
}

.control-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  right: 44px;
  transform: translateY(-50%);
  background: #0c1117;
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 8px 20px var(--shadow);
}

.control-btn:hover::after {
  opacity: 1;
}

.control-menu {
  position: absolute;
  right: 72px;
  top: 122px;
  background: #262a30;
  border: 1px solid #343a43;
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 6px;
  z-index: 4;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.control-menu[hidden] {
  display: none;
}

.control-menu__item {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.control-menu__item:hover {
  background: #3a404a;
}

.character__emoji {
  font-size: 96px;
  transition: transform 0.4s ease, opacity 0.4s ease;
  z-index: 1;
  animation: float 6s ease-in-out infinite;
  cursor: default;
}

.character__motion {
  transition: transform 0.18s ease;
  will-change: transform;
}

.character__emoji.state-interact {
  animation: peek 1.6s ease-in-out infinite;
}

.character__emoji.state-reaction {
  animation: reaction 0.8s ease-out;
}

.character__emoji.state-special {
  animation: special 1.4s ease-in-out;
}

.character__emoji.state-end {
  opacity: 0.7;
  filter: grayscale(0.2);
}

.character__bubble {
  position: absolute;
  bottom: 24px;
  left: 12px;
  width: 220px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bubble);
  border: 1px solid var(--bubble-border);
  box-shadow: 0 12px 25px var(--shadow);
  animation: bubbleIn 0.4s ease;
}

.character__bubble::after {
  content: none;
}

.bubble__content {
  font-size: 13px;
  line-height: 1.4;
}

.bubble__header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
}

.bubble__name {
  font-weight: 600;
  color: #d9e1ea;
}

.bubble__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #2bd97f;
  box-shadow: 0 0 6px rgba(43, 217, 127, 0.6);
  order: -1;
}

.bubble__time {
  color: var(--muted);
}

.bubble__title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #d9e1ea;
}

.bubble__actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.bubble__actions button {
  border: 1px solid transparent;
  background: #202a36;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.bubble__actions button:hover {
  transform: translateY(-2px);
  border-color: #ffffff;
}

.panel {
  display: grid;
  gap: 16px;
  width: min(72vw, 900px);
}

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 19, 0.55);
  display: grid;
  place-items: center;
  z-index: 999;
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

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

.settings-panel {
  width: min(58vw, 720px);
  pointer-events: auto;
}

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

.settings-panel__close {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.settings-panel__close-icon {
  width: 14px;
  height: 14px;
  display: block;
}
.settings-group {
  display: grid;
  gap: 10px;
  padding: 10px 0;
}

.settings-group:first-of-type {
  padding-top: 0;
}

.settings-group__title {
  font-size: 13px;
  color: #d9e1ea;
  font-weight: 600;
}

.settings-group__note {
  font-size: 11px;
  color: var(--muted);
}

.settings-group__row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.settings-field__input {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.settings-field__suffix {
  color: var(--muted);
  font-size: 12px;
}

.settings-field--full {
  width: 100%;
}

.settings-sep {
  color: var(--muted);
  font-size: 12px;
  align-self: center;
  line-height: 40px;
  height: 40px;
  display: flex;
  align-items: center;
}

.settings-actions {
  display: flex;
  justify-content: center;
  padding-top: 10px;
}

.settings-save {
  width: 100%;
  padding: 10px 14px;
}

.info-panel {
  width: min(58vw, 720px);
}

.info-panel__body {
  display: grid;
  gap: 6px;
  color: #ffffff;
  font-family: "Noto Sans JP", "Manrope", sans-serif;
  font-size: 0.8125rem;
  font-style: normal;
  font-weight: 400;
  line-height: 200%;
}

.info-panel__credit {
  color: var(--muted);
  font-size: 11px;
}

.info-panel__credit a {
  color: #8db1ff;
  text-decoration: none;
}

.info-panel__credit a:hover {
  text-decoration: underline;
}

.panel__section {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 22px var(--shadow);
}

.settings-panel,
.info-panel {
  padding: 22px;
}

.settings-panel.panel__section,
.info-panel.panel__section {
  padding: 24px;
}

.panel__title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.panel__row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.panel__row label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.settings-panel input,
.settings-panel select {
  min-height: 40px;
  padding: 10px 10px;
  font-size: 14px;
  border-radius: 12px;
  background: #0e141c;
  border: 1px solid var(--panel-border);
  color: var(--text);
  appearance: none;
}

.settings-panel select {
  max-height: 160px;
}

.settings-field__input select {
  background-image: url("icon/icon_menu.svg");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
}

.settings-field__input .freq-select {
  padding-right: 42px;
  background-position: right 16px center;
}

.settings-panel input[type="time"] {
  color-scheme: dark;
}

.settings-panel input[type="number"] {
  min-height: 40px;
}

.panel__row--actions {
  justify-content: flex-end;
}

.btn {
  border: 1px solid var(--panel-border);
  background: #1c242f;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  background: #253040;
  border-color: #ffffff;
}

.btn--primary {
  background: #194dea;
  color: #ffffff;
  border-color: transparent;
}

.btn--danger {
  background: #3a1a1a;
  border-color: #5a2a2a;
  color: #ffd7d7;
}

.btn--danger:hover {
  background: #4a2222;
}

.btn--ghost {
  background: transparent;
}

.btn--ghost:hover {
  background: #2a3340;
}

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

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.flame-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.snack-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 10px;
  border-radius: 2px;
  opacity: 0;
  animation: confettiFall 1.2s ease-out forwards;
}

.confetti--round {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.flame {
  position: absolute;
  font-size: 28px;
  opacity: 0;
  animation: flameBurst 0.9s ease-out forwards;
  filter: drop-shadow(0 0 8px rgba(255, 140, 0, 0.45));
}

.snack {
  position: absolute;
  font-size: 30px;
  animation: snackNibble 1.6s ease-out forwards;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
}

@keyframes haloPulse {
  0%, 100% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

@keyframes bubbleIn {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes peek {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.05);
  }
}

@keyframes reaction {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.2) rotate(6deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes special {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.25) rotate(-8deg);
  }
  60% {
    transform: scale(1.1) rotate(8deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(140px) rotate(220deg);
    opacity: 0;
  }
}

@keyframes flameBurst {
  0% {
    transform: scale(0.6) translateY(20px);
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  100% {
    transform: scale(1.3) translateY(-40px);
    opacity: 0;
  }
}

@keyframes snackNibble {
  0% {
    transform: translate(-10px, 12px) scale(0.7);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  50% {
    transform: translate(10px, 2px) scale(0.85);
  }
  80% {
    transform: translate(20px, -6px) scale(0.55);
  }
  100% {
    transform: translate(26px, -12px) scale(0.4);
    opacity: 0;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@media (max-width: 860px) {
  body {
    align-items: stretch;
  }

  .app__main {
    grid-template-columns: 1fr;
  }

  .character {
    min-height: 280px;
  }

  .app {
    width: 100%;
    aspect-ratio: auto;
    max-height: none;
    min-height: 100vh;
    padding: 20px;
  }
}
