:root {
  --cw-bg: #f7f2ea;
  --cw-panel: #fffdf8;
  --cw-ink: #2c1a12;
  --cw-accent: #9b5b2a;
  --cw-accent-2: #d9b08c;
  --cw-border: #e3d6c6;
}

.coffee-wars-wrapper {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--cw-ink);
}

#coffee-wars {
  background: radial-gradient(circle at top left, #fffdf7 0%, #f4e9db 45%, #eadbc7 100%);
  border: 2px solid var(--cw-border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 18px 40px rgba(44, 26, 18, 0.15);
  position: relative;
  overflow: hidden;
}

.cw-screen {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.cw-screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.cw-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.cw-title {
  font-size: 32px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cw-subtitle {
  font-size: 14px;
  color: #6a4a36;
}

.cw-menu {
  background: var(--cw-panel);
  border: 1px solid var(--cw-border);
  border-radius: 16px;
  padding: 20px;
  margin-top: 18px;
}

.cw-menu h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cw-menu p {
  margin: 0 0 12px 0;
  color: #6a4a36;
}

.cw-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.cw-panel {
  background: var(--cw-panel);
  border: 1px solid var(--cw-border);
  border-radius: 12px;
  padding: 14px;
  min-height: 140px;
}

.cw-panel h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cw-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cw-panel td {
  padding: 4px 0;
}

.cw-log {
  background: #fff9f1;
  border: 1px dashed var(--cw-border);
  border-radius: 12px;
  padding: 14px;
  min-height: 90px;
  margin-bottom: 16px;
  white-space: pre-line;
}

.cw-prompt {
  background: #fffdf9;
  border: 1px solid var(--cw-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.cw-prompt h4 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.cw-inline-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.cw-input {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.cw-input input {
  flex: 1 1 220px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--cw-border);
  font-size: 14px;
}

.cw-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cw-buttons button {
  border: none;
  background: var(--cw-accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.cw-buttons button.secondary {
  background: var(--cw-accent-2);
  color: var(--cw-ink);
}

.cw-buttons button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cw-slot-meta {
  font-size: 12px;
  color: #6a4a36;
  margin: 2px 0 8px 0;
}

.cw-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--cw-border);
  gap: 12px;
}

.cw-setting-row:last-child {
  border-bottom: none;
}

.cw-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cw-footer {
  margin-top: 14px;
  font-size: 12px;
  color: #6a4a36;
  text-align: right;
}

.cw-overlay {
  position: absolute;
  inset: 0;
  background: rgba(44, 26, 18, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.cw-overlay.active {
  display: flex;
}

.cw-overlay-card {
  background: var(--cw-panel);
  border: 1px solid var(--cw-border);
  border-radius: 16px;
  padding: 20px;
  width: min(420px, 100%);
  box-shadow: 0 10px 30px rgba(44, 26, 18, 0.25);
  text-align: center;
}

.cw-loading {
  font-size: 18px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cw-loading-sub {
  font-size: 12px;
  color: #6a4a36;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .cw-title {
    font-size: 24px;
  }

  .coffee-wars-wrapper {
    padding: 16px;
  }
}
