@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600&family=Zen+Kaku+Gothic+New:wght@400;500&display=swap");

:root {
  --bg: #f7f4ef;
  --bg-alt: #efe9df;
  --ink: #211d19;
  --ink-soft: #746c62;
  --ink-faint: #a49a8c;
  --border: #ddd4c4;
  --accent: #b64b3c;
  --accent-hover: #9c3d30;
  --accent-soft: #f0ddd3;
  --romaji: #97722c;
  --en: #3d5f7d;
  --shadow: rgba(60, 45, 25, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --bg-alt: #1f1b15;
    --ink: #f3ede1;
    --ink-soft: #b3a894;
    --ink-faint: #776e5e;
    --border: #332c22;
    --accent: #e2775f;
    --accent-hover: #ec8b74;
    --accent-soft: #3a2620;
    --romaji: #dcb35a;
    --en: #8db3d6;
    --shadow: rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, var(--accent-soft), transparent),
    var(--bg);
  color: var(--ink);
  font-family: "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 3rem 1.5rem 5rem;
  line-height: 1.5;
}

header {
  max-width: 640px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.01em;
  font-weight: 600;
}

h1 .jp {
  font-family: "Noto Sans JP", sans-serif;
  color: var(--accent);
  font-weight: 500;
  font-size: 1.35rem;
  margin-left: 0.4rem;
}

.subtitle {
  color: var(--ink-soft);
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

main {
  max-width: 1120px;
  margin: 0 auto;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 2.5rem;
  align-items: start;
}

.panel-left {
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.panel-right {
  min-height: 300px;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding-right: 0.75rem;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel-left {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .panel-right {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
}

.lookup-card {
  padding: 0;
}

.field-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  gap: 0.4rem;
  flex: 1 1 160px;
}

input, textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  width: 100%;
  margin-top: 1.1rem;
  resize: vertical;
  font-size: 1.05rem;
  line-height: 1.8;
  min-height: 220px;
}

.lyrics-label {
  display: block;
  margin-top: 1.75rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

button {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

button:active {
  transform: scale(0.98);
}

#lookup-btn {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

#lookup-btn:hover {
  background: var(--accent-soft);
}

button.primary {
  margin-top: 1.5rem;
  width: 100%;
  background: var(--accent);
  color: #fff8f5;
  font-weight: 600;
  padding: 0.85rem;
  font-size: 1rem;
  box-shadow: 0 4px 14px var(--shadow);
}

button.primary:hover {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.hint {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: 0.6rem 0 0;
}

.status {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.status.error {
  color: var(--accent);
}

.results {
  margin-top: 0;
}

@media (max-width: 860px) {
  .results {
    margin-top: 3rem;
  }
}

.line-group {
  padding: 1.1rem 1rem 1.1rem 1.1rem;
  border-left: 2px solid var(--border);
  border-radius: 0 8px 8px 0;
  margin-bottom: 0.15rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.line-group:hover {
  border-left-color: var(--accent);
  background-color: var(--bg-alt);
}

.line-japanese {
  font-family: "Noto Sans JP", sans-serif;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.7;
}

.line-romaji {
  font-size: 0.92rem;
  color: var(--romaji);
  margin-top: 0.3rem;
  font-style: italic;
}

.line-translation {
  font-size: 0.95rem;
  color: var(--en);
  margin-top: 0.2rem;
}
