* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(135deg, rgba(0, 120, 215, 0.08), rgba(255, 255, 255, 0.1)),
    #0078d7;
  color: #1f1f1f;
  font-family: "Microsoft JhengHei", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.desktop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px 16px;
}

.window {
  width: min(960px, 100%);
  background: #f3f3f3;
  border: 1px solid #6b6b6b;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
}

.window.is-maximized {
  width: calc(100vw - 2px);
  min-height: calc(100vh - 2px);
}

.window.is-maximized .converter-textarea {
  min-height: calc(100vh - 370px);
}

.window.is-minimized .menu-bar,
.window.is-minimized .window-body {
  display: none;
}

.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  background: #ffffff;
  border-bottom: 1px solid #d0d0d0;
  user-select: none;
}

.title-info {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-left: 10px;
  gap: 8px;
}

.app-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #0078d7;
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
}

.title-text {
  overflow: hidden;
  color: #1f1f1f;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.window-controls {
  display: flex;
  height: 100%;
}

.control {
  position: relative;
  width: 46px;
  min-width: 46px;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.control::before,
.control::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.minimize::before {
  width: 10px;
  height: 1px;
  background: #222;
}

.maximize::before {
  width: 10px;
  height: 10px;
  border: 1px solid #222;
}

.close::before,
.close::after {
  width: 13px;
  height: 1px;
  background: #222;
}

.close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.control:hover {
  background: #e5e5e5;
}

.close:hover {
  background: #e81123;
}

.close:hover::before,
.close:hover::after {
  background: #ffffff;
}

.menu-bar {
  display: flex;
  align-items: stretch;
  min-height: 30px;
  padding: 0 8px;
  background: #f9f9f9;
  border-bottom: 1px solid #d7d7d7;
  color: #333;
  font-size: 13px;
}

.menu-item {
  position: relative;
}

.menu-button {
  min-width: 0;
  min-height: 30px;
  height: 30px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  font-size: 13px;
}

.menu-button:hover,
.menu-item:focus-within .menu-button,
.menu-item:hover .menu-button {
  background: #e5f1fb;
  outline: 1px solid #cce8ff;
}

.menu-panel {
  position: absolute;
  left: 0;
  top: 30px;
  z-index: 10;
  display: none;
  min-width: 150px;
  padding: 3px 0;
  background: #f2f2f2;
  border: 1px solid #979797;
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.22);
}

.menu-item:hover .menu-panel,
.menu-item:focus-within .menu-panel {
  display: block;
}

.menu-panel button {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 26px;
  padding: 4px 24px 4px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
}

.menu-panel button:hover {
  background: #91c9f7;
}

.window-body {
  padding: 22px;
  background: #f3f3f3;
}

.page-header {
  margin-bottom: 18px;
}

.page-header h1 {
  margin: 0 0 6px;
  color: #111;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  line-height: 1.25;
}

.page-header p {
  margin: 0;
  color: #555;
}

.input-label {
  display: block;
  margin-bottom: 6px;
  color: #222;
  font-weight: 600;
}

.converter-textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 12px;
  border: 1px solid #7a7a7a;
  border-radius: 0;
  background: #ffffff;
  color: #111;
  font: inherit;
  line-height: 1.8;
  outline: none;
}

.converter-textarea:hover {
  border-color: #4f4f4f;
}

.converter-textarea:focus {
  border-color: #0078d7;
  box-shadow: 0 0 0 1px #0078d7 inset;
}

.status-text {
  min-height: 1.5em;
  margin: 8px 0 14px;
  color: #555;
  font-size: 13px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

button {
  min-width: 112px;
  min-height: 34px;
  padding: 6px 18px;
  border: 1px solid #8a8a8a;
  border-radius: 0;
  background: #e1e1e1;
  color: #111;
  cursor: pointer;
  font: inherit;
  line-height: 1.4;
}

button:hover {
  border-color: #0078d7;
  background: #e5f1fb;
}

button:active {
  border-color: #005a9e;
  background: #cce4f7;
}

button:focus-visible {
  outline: 2px solid #0078d7;
  outline-offset: 2px;
}

.primary-button {
  border-color: #005a9e;
  background: #0078d7;
  color: #ffffff;
}

.primary-button:hover {
  border-color: #004578;
  background: #006cc1;
}

.primary-button:active {
  background: #005a9e;
}

.tool-actions {
  padding-top: 2px;
}

.restore-window {
  border-color: #005a9e;
  background: #f3f3f3;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

@media (max-width: 640px) {
  .desktop {
    align-items: flex-start;
    padding: 12px;
  }

  .window-body {
    padding: 16px;
  }

  .converter-textarea {
    min-height: 210px;
  }

  .control {
    width: 38px;
    min-width: 38px;
  }

  .menu-bar {
    overflow-x: auto;
  }

  .button-row > button {
    width: 100%;
  }
}
