/* CSS Design System for Novel Generator - Light Paper Theme */
:root {
  --bg-color: #fffef9;
  /* Paper-like warm white */
  --accent-color: #5c4137;
  /* Sophisticated brownish accent */
  --accent-glow: rgba(92, 65, 55, 0.2);
  --gl-bg: rgba(255, 255, 255, 0.7);
  --gl-border: rgba(92, 65, 55, 0.2);
  --text-primary: #2d241e;
  --text-secondary: #6b5c53;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 4rem 1rem;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.container {
  width: 90%;
  max-width: 900px;
  background: var(--gl-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--gl-border);
  border-radius: 24px;
  padding: 3rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--accent-color);
  word-break: auto-phrase;
}

.input-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

textarea,
input[type="text"],
input[type="password"],
select {
  width: 100%;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--gl-border);
  border-radius: 6px;
  padding: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

select option {
  background: white;
  color: var(--text-primary);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

textarea::placeholder {
  color: #c0c0c0;
}

.button-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

button {
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 3px 5px 0px rgba(92, 65, 55, 0.2);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -5px rgba(92, 65, 55, 0.3);
  background: #4a332c;
}

.result-section {
  margin-top: 3rem;
  display: none;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

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

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--gl-border);
  padding-top: 1rem;
}

.result-header h2 {
  font-size: 1.25rem;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

.result-content {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  line-height: 1.8;
  font-size: 1.1rem;
  color: #3d312a;
  white-space: pre-wrap;
  padding: 1rem;
  border-radius: 6px;
  max-height: 600px;
  overflow-y: auto;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  border: 1px solid var(--gl-border);
}

.char-count-display {
  margin-top: 1rem;
  text-align: right;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Custom Scrollbar */
.result-content::-webkit-scrollbar {
  width: 8px;
}

.result-content::-webkit-scrollbar-track {
  background: transparent;
}

.result-content::-webkit-scrollbar-thumb {
  background: #e5e0d8;
  border-radius: 4px;
}

.loader {
  display: none;
  margin: 2rem auto;
  width: 40px;
  height: 40px;
  border: 3px solid #e5e0d8;
  border-radius: 50%;
  border-top-color: var(--accent-color);
  animation: spin 1s ease-in-out infinite;
}

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

.copy-btn {
  background: #fdfaf6;
  border: 1.5px solid #d4cdc3;
  border-radius: 8px;
  padding: 0.4rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-color);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(92, 65, 55, 0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-btn:hover {
  background: #fff;
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(92, 65, 55, 0.15);
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(92, 65, 55, 0.1);
}

.copy-btn.copied {
  background-color: #f4fdec;
  border-color: #1eb910;
  color: #469605;
  font-size: 0.75rem;
}

@media (max-width: 480px) {

  body {
    min-height: 0;
    padding: 1rem;
  }

  .container {
    padding: 1rem;
    width: 100%;
    border-radius: 16px;
  }

  .result-content {
    padding: 0.5rem;
    font-size: 1rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  textarea {
    resize: none;
  }
}

/* Footer & Back Link */
.site-footer {
  margin-top: 1.5rem;
  width: 100%;
  max-width: 900px;
  text-align: center;
}

.back-link {
  color: var(--text-secondary);
  text-decoration: none;
  opacity: 0.6;
  transition: var(--transition);
}

.back-link:hover {
  opacity: 1;
  color: var(--accent-color);
}

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