:root {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e4e9ef;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --border-color: #c4cbd4;
  --border-light: #cbd5e1;
  --accent-primary: #0891b2;
  --accent-primary-active: #077996;
  --accent-secondary: #ea580c;
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --info-bg: #ecfeff;
  --info-border: #0891b2;
  --info-text: #0e7490;
}

[data-theme="dark"] {
  --bg-primary: #0a0e14;
  --bg-secondary: #161d26;
  --bg-tertiary: #1f2937;
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border-color: #2d3748;
  --border-light: #334155;
  --accent-primary: #00c2cb;
  --accent-secondary: #ff8c00;
  --shadow-light: rgba(0, 0, 0, 0.4);
  --shadow-medium: rgba(0, 0, 0, 0.7);
  --info-bg: rgba(0, 194, 203, 0.05);
  --info-border: #00c2cb;
  --info-text: #00c2cb;
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: background 0.3s ease;
}

.container {
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 1200px;
  width: 100%;
  padding: 40px;
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.header {
  text-align: center;
}

.header a {
  text-decoration: none;
}

.header h1 {
  color: var(--accent-primary);
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.top-controls {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.top-content {
  display: flex;
  gap: 8px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

.control-group select {
  padding: 6px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-group select:hover,
.control-group select:focus {
  border-color: var(--accent-primary);
  outline: none;
}

.top-button {
  padding: 4px 6px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.top-button:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary-active);
}

.content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.video-container {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.video-container iframe {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--border-color);
  border-radius: 8px;
}

.input-wrapper select {
  background-color: var(--bg-tertiary);
}

input[type="text"],
input[type="number"],
select {
  flex: 1;
  padding: 12px 15px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  font-family: inherit;
  background: var(--bg-primary);
  color: var(--text-primary);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="number"] {
  font-weight: 500;
}

input[type="range"] {
  flex-grow: 1;
  cursor: pointer;
  margin: 0;
}

input[type="range"]::-webkit-slider-thumb {
  cursor: ew-resize;
}

.step {
  flex: 0;
  background-color: transparent;
  color: var(--text-primary);
  padding: 15px;
}

.unit {
  padding: 12px 15px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 2px solid var(--border-color);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.input-wrapper .value {
  text-align: center;
  padding: 12px 15px;
  min-width: 70px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 2px solid var(--border-color);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.radio-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-group {
  display: flex;
  gap: 10px;
}

.radio-group > .radio-option {
  flex: 1;
}

.radio-option {
  display: flex;
  flex-grow: 1;
  align-items: center;
  cursor: pointer;
}

.radio-option label {
  flex: 1;
  font-weight: bold;
  text-align: center;
  border-radius: 8px;
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  background-color: var(--bg-tertiary);
}

.radio-option input[type="radio"]:checked + label {
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary-active);
}

.radio-option input[type="radio"] {
  display: none;
}

input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.radio-option label {
  margin: 0;
  cursor: pointer;
  font-weight: 400;
  color: var(--text-primary);
}

.hidden {
  display: none;
}

.button-group {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

button {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-calculate {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-calculate:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-reset {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-reset:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.draw-container {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 15px;
  border: 2px solid var(--border-light);
  padding: 10px;
}

.draw-container .draw {
  width: 100%;
  background-size: cover;
  border-radius: 10px;
  border: 1px solid #0f172a;
  background: var(--bg-tertiary);
}

.draw-container .save {
  position: absolute;
  right: -2px;
  bottom: -2px;
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  padding: 15px;
  border-radius: 15px;
  border-top-right-radius: 0;
  border-bottom-left-radius: 0;
  opacity: 0.5;
}

.draw-container .save:hover {
  background-color: var(--accent-primary);
  border: 2px solid var(--accent-primary-active);
  opacity: 1;
}

.box-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: var(--bg-secondary);
  border-radius: 15px;
  padding: 10px;
  border: 2px solid var(--border-light);
  transition:
    background 0.3s ease,
    border-color 0.3s ease;
}

.results-row {
  display: flex;
  gap: 10px;
}

.results-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.result-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  background: var(--bg-tertiary);
  padding: 7px 10px;
  border-radius: 12px;
  border-bottom: 4px solid var(--accent-primary-active);
  box-shadow: 0 2px 8px var(--shadow-light);
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.result-item.highlight {
  background: var(--bg-primary);
  border-bottom: 4px solid var(--accent-primary);
}

.result-item.highlight .result-label {
  font-size: 1rem;
}

.result-item.highlight .result-value {
  font-size: 1.25rem;
}

.result-label {
  font-size: 0.75rem;
  text-align: left;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  margin-right: 5px;
  font-weight: bold;
}

.result-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: "Courier New", monospace;
  margin-left: auto;
}

.info-box {
  background: var(--info-bg);
  border-left: 4px solid var(--info-border);
  padding: 15px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--accent-primary);
  line-height: 1.6;
  transition:
    background 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease;
}

.info-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: var(--info-border);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 20px;
  margin-right: 8px;
  font-size: 0.8rem;
  font-weight: bold;
}

.footer {
  text-align: center;
}

.footer a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.3s;
  font-family: sans-serif;
}

.footer a:hover {
  color: var(--accent-primary);
}

#app-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  font-weight: bold;
  padding: 10px 20px;
  border-radius: 8px;
  pointer-events: none;
  transition: bottom 0.3s ease;
}

#app-toast.hide {
  display: block;
  bottom: -50%;
}

.hide {
  display: none;
}

.mobile-show {
  display: none;
}

.mobile-hide {
  display: block;
}

@media (max-width: 900px) {
  .results-row {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .top-controls {
    justify-content: center;
  }

  .control-group select {
    width: 100%;
  }

  .header h1 {
    font-size: 1.8rem;
  }

  .container {
    padding: 20px;
  }

  .mobile-show {
    display: block;
  }

  .mobile-hide {
    display: none;
  }
}
