:root {
  color-scheme: dark;
  --bg: #0b0d1a;
  --night: #10122a;
  --violet: #36224f;
  --glass: rgba(19, 18, 38, 0.72);
  --glass-strong: rgba(25, 23, 48, 0.86);
  --ink: #fbf6ea;
  --muted: #c8bfd6;
  --line: rgba(224, 190, 116, 0.28);
  --gold: #e8c777;
  --gold-soft: #f7dfaa;
  --lavender: #c7b8ff;
  --crystal: #dff7ff;
  --shadow: rgba(0, 0, 0, 0.36);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 199, 119, 0.13), transparent 24rem),
    radial-gradient(circle at 15% 18%, rgba(199, 184, 255, 0.18), transparent 20rem),
    radial-gradient(circle at 82% 24%, rgba(223, 247, 255, 0.11), transparent 18rem),
    linear-gradient(160deg, #080914 0%, #111330 46%, #160d22 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.35) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(232, 199, 119, 0.22) 0 1px, transparent 1.4px);
  background-size: 8rem 7rem, 11rem 9rem;
  opacity: 0.3;
  animation: starBreath 18s ease-in-out infinite alternate;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(100% - 1.25rem, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 2.2rem 0 1.6rem;
  display: grid;
  gap: 1rem;
}

.hero-area {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.65rem;
  padding: 2.2rem 0.55rem 1rem;
}

.hero-area::before {
  content: "";
  position: absolute;
  width: min(76vw, 22rem);
  aspect-ratio: 1;
  top: 0.2rem;
  border: 1px solid rgba(232, 199, 119, 0.16);
  border-radius: 50%;
  box-shadow: inset 0 0 42px rgba(199, 184, 255, 0.08), 0 0 60px rgba(232, 199, 119, 0.08);
  animation: ringDrift 42s linear infinite;
  z-index: -1;
}

.eyebrow,
.matrix-kicker,
.status-label {
  margin: 0;
  color: var(--gold-soft);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  font-weight: 400;
}

h1 {
  font-size: clamp(2.85rem, 12vw, 4.45rem);
  line-height: 0.92;
}

h2 {
  font-size: 1.55rem;
}

.tagline {
  margin: 0;
  color: var(--gold-soft);
  font-size: 1rem;
  line-height: 1.7;
}

.subtitle {
  max-width: 28rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.9;
}

.oracle-card,
.star-card,
.about-card,
.note-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(30, 25, 58, 0.78), rgba(12, 15, 32, 0.82));
  box-shadow: 0 24px 80px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
}

.oracle-card {
  display: grid;
  gap: 1rem;
  padding: 1.05rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--gold-soft);
  font-size: 0.92rem;
}

.input-guide {
  margin: -0.15rem 0 0.2rem;
  padding: 0 0.2rem;
  color: rgba(205, 199, 219, 0.72);
  font-size: 0.76rem;
  line-height: 1.8;
}

.wish-guide {
  margin-top: -0.35rem;
}

.save-guide {
  margin: -0.05rem 0 0;
  color: rgba(205, 199, 219, 0.66);
  font-size: 0.76rem;
  line-height: 1.7;
  text-align: center;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(199, 184, 255, 0.22);
  border-radius: 12px;
  background: rgba(5, 7, 18, 0.62);
  color: var(--ink);
  padding: 0.95rem 1rem;
  outline: none;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.16);
}

textarea {
  min-height: 7.5rem;
  resize: vertical;
  line-height: 1.75;
}

input::placeholder,
textarea::placeholder {
  color: rgba(200, 191, 214, 0.58);
}

input:focus,
textarea:focus {
  border-color: rgba(232, 199, 119, 0.68);
  box-shadow: 0 0 0 3px rgba(232, 199, 119, 0.12), inset 0 0 18px rgba(0, 0, 0, 0.16);
}

.duration-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(232, 199, 119, 0.25);
  border-radius: 14px;
  padding: 0.86rem 1rem;
  color: var(--muted);
  background: rgba(232, 199, 119, 0.06);
}

.duration-panel strong {
  color: var(--gold-soft);
  font-weight: 600;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.68rem;
}

button {
  min-height: 3.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  color: var(--ink);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary-action,
.save-action,
.talisman-action,
.wallpaper-action,
.video-action {
  background: linear-gradient(135deg, #f4dfa7, #d0a84e 52%, #8d6bce);
  color: #17101c;
  font-weight: 700;
  box-shadow: 0 0 26px rgba(232, 199, 119, 0.24);
}

.save-action {
  box-shadow: 0 0 34px rgba(232, 199, 119, 0.34);
}

.talisman-action {
  border-color: rgba(221, 244, 255, 0.32);
  background: linear-gradient(135deg, #e8e0bd, #c7b9f4 52%, #bce7f5);
  box-shadow: 0 0 30px rgba(199, 185, 244, 0.25);
}

.wallpaper-action {
  border-color: rgba(221, 244, 255, 0.28);
  background: linear-gradient(135deg, #d9d3ef, #aebfe8 52%, #d8efe9);
  box-shadow: 0 0 30px rgba(174, 191, 232, 0.22);
}

.video-action {
  border-color: rgba(221, 244, 255, 0.3);
  background: linear-gradient(135deg, #f0dca9, #b8b6e9 52%, #b9e1e8);
  box-shadow: 0 0 30px rgba(199, 185, 244, 0.24);
}

.video-guide {
  margin: 0;
  color: rgba(205, 199, 219, 0.7);
  font-size: 0.76rem;
  line-height: 1.75;
  text-align: center;
}

.video-guide a {
  display: inline-block;
  margin-top: 0.2rem;
  color: var(--crystal);
  text-underline-offset: 0.2em;
}

.video-save-result {
  margin-top: 0.9rem;
  padding: 1rem;
  border: 1px solid rgba(240, 221, 166, 0.3);
  border-radius: 8px;
  background: rgba(22, 20, 42, 0.8);
  color: rgba(245, 242, 255, 0.9);
  font-size: 0.82rem;
  line-height: 1.75;
  text-align: center;
}

.video-save-result[hidden] {
  display: none;
}

.video-save-result p {
  margin: 0.55rem 0 0;
}

.mp4-convert-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 0.8rem;
  padding: 0 1rem;
  border: 1px solid rgba(221, 246, 255, 0.32);
  border-radius: 6px;
  background: rgba(31, 28, 57, 0.94);
  color: var(--crystal);
  font-weight: 700;
  text-decoration: none;
}

.video-diagnostic-panel {
  overflow: hidden;
  border: 1px solid rgba(210, 198, 250, 0.2);
  border-radius: 8px;
  background: rgba(8, 9, 20, 0.36);
}

.video-diagnostic-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 54px;
  padding: 0.8rem 1rem;
  color: rgba(240, 221, 166, 0.82);
  cursor: pointer;
  font-size: 0.9rem;
  list-style: none;
}

.video-diagnostic-panel summary::-webkit-details-marker {
  display: none;
}

.diagnostic-toggle-label {
  color: rgba(221, 246, 255, 0.7);
  font-size: 0.75rem;
}

.video-diagnostic-panel details[open] .diagnostic-toggle-label {
  font-size: 0;
}

.video-diagnostic-panel details[open] .diagnostic-toggle-label::after {
  content: "診断パネルを閉じる";
  font-size: 0.75rem;
}

.video-diagnostic-content {
  padding: 0 1rem 1rem;
}

.diagnostic-mode {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.75rem;
  color: rgba(231, 226, 242, 0.72);
  font-size: 0.76rem;
}

.diagnostic-mode select {
  min-height: 42px;
  padding: 0 0.65rem;
  border: 1px solid rgba(210, 198, 250, 0.24);
  border-radius: 6px;
  background: #111024;
  color: #f5f1ff;
}

.diagnostic-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.diagnostic-actions button {
  min-height: 42px;
  border: 1px solid rgba(221, 246, 255, 0.2);
  border-radius: 6px;
  background: rgba(31, 28, 57, 0.88);
  color: rgba(245, 242, 255, 0.88);
  font-size: 0.76rem;
}

.diagnostic-current-mode,
.diagnostic-note,
.diagnostic-copy-status {
  margin: 0.55rem 0 0;
  color: rgba(205, 199, 219, 0.7);
  font-size: 0.74rem;
}

.diagnostic-note {
  color: rgba(232, 249, 255, 0.62);
  line-height: 1.65;
}

.diagnostic-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.9rem;
  color: rgba(240, 221, 166, 0.78);
  font-size: 0.78rem;
}

.diagnostic-log-head button {
  min-height: 38px;
  padding: 0 0.75rem;
  border: 1px solid rgba(221, 246, 255, 0.2);
  border-radius: 6px;
  background: rgba(31, 28, 57, 0.88);
  color: rgba(245, 242, 255, 0.88);
}

.video-diagnostic-panel pre {
  max-height: 210px;
  margin: 0.65rem 0 0;
  padding: 0.65rem;
  overflow: auto;
  border-radius: 6px;
  background: rgba(3, 4, 10, 0.72);
  color: rgba(221, 246, 255, 0.78);
  font: 0.68rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 420px) {
  .diagnostic-actions {
    grid-template-columns: 1fr;
  }
}

.secondary-action {
  background: rgba(17, 17, 36, 0.82);
  border-color: rgba(199, 184, 255, 0.25);
}

.star-card {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.star-card-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.star-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.talisman-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(232, 199, 119, 0.19);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(221, 244, 255, 0.08), transparent 42%),
    #080914;
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.52),
    0 0 48px rgba(199, 185, 244, 0.09);
}

.talisman-wrap::before,
.talisman-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

.talisman-wrap::before {
  inset: 4%;
  border: 1px solid rgba(231, 214, 163, 0.08);
  box-shadow:
    inset 0 0 28px rgba(221, 244, 255, 0.04),
    0 0 26px rgba(199, 185, 244, 0.04);
}

.talisman-wrap::after {
  inset: 12%;
  border: 1px solid rgba(199, 185, 244, 0.05);
}

.talisman-canvas {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: talismanBreath 9s ease-in-out infinite alternate;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
}

.legend-dot {
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.legend-dot.self {
  background: var(--gold);
  color: var(--gold);
}

.legend-dot.partner {
  background: var(--lavender);
  color: var(--lavender);
}

.legend-dot.wish {
  background: var(--crystal);
  color: var(--crystal);
}

.oracle-id {
  margin: -0.2rem 0 0;
  color: rgba(200, 191, 214, 0.58);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-align: center;
}

.status-panel {
  display: grid;
  gap: 0.72rem;
  border-top: 1px solid rgba(232, 199, 119, 0.14);
  padding-top: 0.86rem;
}

.status-line {
  display: grid;
  gap: 0.18rem;
}

.status-value {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
}

.progress-shell {
  height: 0.42rem;
  border-radius: 999px;
  background: rgba(4, 6, 15, 0.7);
  overflow: hidden;
}

#progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--lavender), var(--crystal));
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0;
}

.signature-grid div {
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  padding-top: 0.5rem;
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
}

dd {
  margin: 0.2rem 0 0;
  color: var(--ink);
  font-size: 0.82rem;
}

.about-card,
.note-card {
  padding: 1rem;
  color: var(--muted);
  line-height: 1.85;
  font-size: 0.88rem;
}

.about-card {
  display: grid;
  gap: 0.7rem;
}

.about-card[hidden] {
  display: none;
}

.about-card h2 {
  color: var(--gold-soft);
  font-size: 1.2rem;
}

.about-card p,
.note-card p {
  margin: 0;
}

.privacy-note {
  margin-top: 0.7rem !important;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(200, 191, 214, 0.72);
  font-size: 0.78rem;
}

@keyframes starBreath {
  from {
    opacity: 0.24;
  }
  to {
    opacity: 0.44;
  }
}

@keyframes talismanBreath {
  from {
    filter: brightness(0.98) saturate(0.99);
    opacity: 0.97;
  }
  to {
    filter: brightness(1.03) saturate(1.02);
    opacity: 1;
  }
}

@keyframes ringDrift {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 760px) {
  .app-shell {
    width: min(100% - 2rem, 960px);
    grid-template-columns: minmax(21rem, 0.85fr) minmax(22rem, 1.15fr);
    align-items: start;
    padding-top: 3rem;
  }

  .hero-area,
  .oracle-card,
  .about-card,
  .note-card {
    grid-column: 1;
  }

  .star-card {
    grid-column: 2;
    grid-row: 1 / span 3;
    position: sticky;
    top: 1.5rem;
  }
}
