@charset "UTF-8";
:root {
  --font-family: system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --line-height: 1.5;
  --border-radius: 0.5rem;
  --spacing: 1rem;
  --transition: 150ms ease-in-out;
  --bg: #fff;
  --fg: #1a1a1a;
  --panel: #f8f9fa;
  --panel-hover: #e9ecef;
  --border: #dee2e6;
  --primary: #4263eb;
  --primary-hover: #3b5bdb;
  --shadow: rgba(0, 0, 0, 0.1);
}

body.dark {
  --bg: #11191f;
  --fg: #c2c7d0;
  --panel: #1a252f;
  --panel-hover: #232f3e;
  --border: #2d3e50;
  --primary: #5c7cfa;
  --primary-hover: #748ffc;
  --shadow: rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-family);
  line-height: var(--line-height);
  margin: 0;
  padding: 0;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--spacing);
}

@media (min-width: 768px) {
  .container {
    padding: calc(var(--spacing) * 2);
  }
}
h1 {
  margin-top: 0;
  margin-bottom: calc(var(--spacing) * 1.5);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
}

header {
  margin-bottom: calc(var(--spacing) * 2);
  padding-bottom: var(--spacing);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#theme-toggle {
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.2rem;
}
#theme-toggle:hover {
  background: var(--panel);
  border-color: var(--primary);
  transform: scale(1.05);
}

textarea {
  width: 100%;
  min-height: 150px;
  padding: calc(var(--spacing) * 0.75);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--fg);
  font-size: 1rem;
  font-family: var(--font-family);
  line-height: var(--line-height);
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(66, 99, 235, 0.1);
}
textarea::placeholder {
  color: #6c757d;
  opacity: 0.7;
}

/* Controls wrap — stacked rows */
.controls {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1.25);
  margin-top: calc(var(--spacing) * 1.25);
}

.controls .row {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 0.75);
}
.controls .row select {
  flex: 1 1 240px;
}

select {
  padding: calc(var(--spacing) * 0.5) calc(var(--spacing) * 0.75);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--fg);
  font-size: 1rem;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition);
}
select:hover {
  background: var(--panel-hover);
  border-color: var(--primary);
}
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(66, 99, 235, 0.1);
}

/* Submit CTA */
.submit-wrap {
  display: flex;
  justify-content: center;
  margin-top: calc(var(--spacing) * 1);
}

button[type=submit] {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 12px var(--shadow);
}
button[type=submit]:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
button[type=submit]:active {
  transform: translateY(0);
}

button.loading {
  opacity: 0.6;
  pointer-events: none;
}
button.loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-block;
  margin-left: 0.5rem;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
/* Prompt chips */
.preset-prompts {
  margin-top: 1rem;
}

.prompt-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.prompt-list li {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.9rem;
}
.prompt-list li:hover {
  background: var(--panel-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Rhetorical Device UI */
.rhetoric-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

#rhetoric-info {
  margin-top: 0rem;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  line-height: 1.45;
}
#rhetoric-info h4 {
  margin: 0 0 0.35rem 0;
  font-weight: 600;
}
#rhetoric-info .description {
  opacity: 0.85;
}
#rhetoric-info .example {
  opacity: 0.65;
  font-style: italic;
}

/* ----- CARD STYLE ----- */
.sharpen-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1.25rem 1.5rem;
  margin-top: 1rem;
  line-height: 1.55;
  box-shadow: 0 2px 6px var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-footer {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 0rem;
  opacity: 0.8;
}

.history-delete {
  border: none;
  background: transparent;
  color: var(--fg);
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.5;
}
.history-delete:hover {
  opacity: 1;
}

#history-board {
  margin-top: 2rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-behavior: smooth;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.history-column {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.column-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  opacity: 0.85;
}

.history-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem 1rem;
  box-shadow: 0 2px 6px var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.history-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px var(--shadow);
}

.history-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.4;
}
.history-delete:hover {
  opacity: 1;
}

.history-label {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.65;
}

.history-text,
.history-prompt {
  white-space: pre-wrap;
  line-height: 1.45;
  margin-bottom: 0.25rem;
}

.history-prompt {
  opacity: 0.6;
  font-style: italic;
}

.history-time {
  font-size: 0.75rem;
  opacity: 0.6;
  text-align: right;
  margin-top: 0.5rem;
}