body {
  background: #f6f8fa;
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-flex {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  width: 100vw;
  box-sizing: border-box;
  gap: 2.5rem;
}

.container {
  margin: 0 0 0 3rem;
  background: #fff;
  padding: 2rem 2.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  max-width: 350px;
  width: 100%;
  text-align: center;
}

.image-side {
  /* flex: 1; */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: auto;
  border-radius: 12px;
  padding: 1rem 1rem 1rem 0.5rem;
}

.image-side img {
  max-width: 100%;
  max-height: 40vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: none;
}

h1 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  color: #222;
}

.input-group {
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.input-group label {
  min-width: 60px;
  margin-bottom: 0;
  flex-shrink: 0;
}

input[type="number"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: border 0.2s;
}

input[type="number"]:focus {
  border-color: #2563eb;
  outline: none;
}

button {
  width: 100%;
  padding: 0.7rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #1d4ed8;
}

.result {
  margin-top: 1.5rem;
  font-size: 1.1rem;
  color: #2563eb;
  min-height: 1.5em;
}

.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
}

select {
  padding: 0.45rem 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  background: #f6f8fa;
  color: #222;
  transition: border 0.2s;
}

select:focus {
  border-color: #2563eb;
  outline: none;
}

input[readonly] {
  background: #f3f4f6;
  color: #888;
}

/* Theme switch slider */
.theme-switch {
  position: fixed;
  top: 1.5rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  user-select: none;
}
.theme-switch input {
  display: none;
}
.theme-switch .slider {
  width: 36px;
  height: 20px;
  background: #ccc;
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
  margin: 0 0.2rem;
}
.theme-switch .slider:before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.theme-switch input:checked + .slider {
  background: #2563eb;
}
.theme-switch input:checked + .slider:before {
  transform: translateX(16px);
}
.theme-switch .icon {
  font-size: 1.1rem;
  line-height: 1;
  pointer-events: none;
}
.theme-switch .icon.sun {
  color: #fbbf24;
}
.theme-switch .icon.moon {
  color: #2563eb;
}

body.dark {
  background: #181a1b;
}

body.dark .container {
  background: #23272b;
  color: #f3f4f6;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}

body.dark h1 {
  color: #f3f4f6;
}

body.dark label {
  color: #e0e6ed;
}

body.dark input[type="number"],
body.dark input[readonly],
body.dark select {
  background: #23272b;
  color: #f3f4f6;
  border: 1px solid #444c56;
}

body.dark input[type="number"]:focus,
body.dark select:focus {
  border-color: #60a5fa;
}

body.dark .result {
  color: #60a5fa;
}

body.dark input[readonly] {
  background: #59595a;
  color: #bfc7d5;
  border: 1px solid #444c56;
  opacity: 1;
}

.text-window {
  flex: 1 1 55%;
  max-width: 55vw;
  height: 80vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  margin: 0 2rem 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.text-content {
  padding: 2rem;
  overflow-y: auto;
  height: 100%;
  line-height: 1.6;
}

.text-content h2 {
  color: #222;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.text-content h3 {
  color: #333;
  margin: 1.5rem 0 0.5rem 0;
  font-size: 1.2rem;
}

.text-content p {
  margin-bottom: 1rem;
  color: #444;
}

.text-content ul {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.text-content li {
  margin-bottom: 0.5rem;
  color: #444;
}

.text-content code {
  background: #f3f4f6;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  color: #d63384;
  display: inline-block;
  margin: 0.5rem 0;
}

.text-content strong {
  color: #222;
  font-weight: 600;
}

/* Dark mode for text window */
body.dark .text-window {
  background: #23272b;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}

body.dark .text-content h2 {
  color: #f3f4f6;
}

body.dark .text-content h3 {
  color: #e0e6ed;
}

body.dark .text-content p,
body.dark .text-content li {
  color: #bfc7d5;
}

body.dark .text-content code {
  background: #2d3748;
  color: #fbbf24;
}

body.dark .text-content strong {
  color: #f3f4f6;
}

@media (max-width: 1200px) {
  .main-flex {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }
  .container {
    margin: 2rem 0 0 0;
  }
  .image-side {
    padding: 1rem 0;
  }
  .text-window {
    max-width: 90vw;
    height: 50vh;
    margin: 0 0 2rem 0;
  }
}

@media (max-width: 900px) {
  .main-flex {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
  }
  .container {
    margin: 2rem 0 1rem 0;
    max-width: 95vw;
  }
  .image-side {
    height: auto;
    margin-bottom: 2rem;
    padding: 1rem 0;
    background: none;
    box-shadow: none;
  }
  .image-side img {
    max-width: 95vw;
    max-height: 40vh;
  }
}