/* Rather Listen Pronunciation Helper Tool v1.0.0 */
:root {
  --rl-ph-bg: #ffffff;
  --rl-ph-text: #17211f;
  --rl-ph-muted: #5c6b66;
  --rl-ph-border: #d8e3df;
  --rl-ph-soft: #f4f8f7;
  --rl-ph-primary: #0b7e67;
  --rl-ph-primary-dark: #075a4a;
  --rl-ph-warning: #ffc42c;
  --rl-ph-danger: #b42318;
  --rl-ph-shadow: 0 14px 35px rgba(11, 126, 103, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--rl-ph-text);
  background: #edf4f2;
}

.demo-page {
  padding: 30px 15px;
}

.demo-shell {
  max-width: 1100px;
  margin: 0 auto;
}

.demo-note,
.demo-output p {
  color: var(--rl-ph-muted);
  line-height: 1.5;
}

.rl-ph {
  background: var(--rl-ph-bg);
  border: 1px solid var(--rl-ph-border);
  border-radius: 18px;
  box-shadow: var(--rl-ph-shadow);
  padding: 24px;
}

.rl-ph h2,
.rl-ph h3 {
  margin: 0 0 12px;
}

.rl-ph-section {
  margin-bottom: 28px;
}

.rl-ph-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.rl-ph-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rl-ph label,
.demo-output label {
  font-weight: 700;
  font-size: 0.95rem;
}

.rl-ph input[type="text"],
.rl-ph select,
.demo-output textarea {
  width: 100%;
  border: 1px solid var(--rl-ph-border);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
  color: var(--rl-ph-text);
}

.rl-ph input[type="text"]:focus,
.rl-ph select:focus,
.demo-output textarea:focus {
  outline: 3px solid rgba(11, 126, 103, 0.22);
  border-color: var(--rl-ph-primary);
}

.rl-ph-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rl-ph-button,
.demo-output button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--rl-ph-primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

.rl-ph-button:hover,
.rl-ph-button:focus,
.demo-output button:hover,
.demo-output button:focus {
  background: var(--rl-ph-primary-dark);
}

.rl-ph-button:focus-visible,
.rl-ph-icon-button:focus-visible,
.demo-output button:focus-visible {
  outline: 3px solid rgba(255, 196, 44, 0.75);
  outline-offset: 3px;
}

.rl-ph-button-secondary {
  background: #eff6f4;
  color: var(--rl-ph-primary-dark);
}

.rl-ph-button-secondary:hover,
.rl-ph-button-secondary:focus {
  background: #dcece8;
}

.rl-ph-button-danger {
  background: var(--rl-ph-danger);
}

.rl-ph-button-disabled,
.rl-ph-button:disabled,
.demo-output button:disabled {
  background: #9aa5a1;
  color: #f3f3f3;
  cursor: not-allowed;
}

.rl-ph-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--rl-ph-soft);
  border: 1px solid var(--rl-ph-border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 16px;
}

.rl-ph-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.rl-ph-checkbox-row input {
  width: 20px;
  height: 20px;
}

.rl-ph-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.rl-ph-card {
  border: 1px solid var(--rl-ph-border);
  border-radius: 16px;
  padding: 15px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 175px;
}

.rl-ph-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}

.rl-ph-word {
  font-size: 1.05rem;
  font-weight: 800;
  word-break: break-word;
}

.rl-ph-ipa {
  color: var(--rl-ph-muted);
  word-break: break-word;
}

.rl-ph-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.rl-ph-icon-set {
  display: flex;
  gap: 6px;
}

.rl-ph-icon-button {
  border: 1px solid var(--rl-ph-border);
  background: var(--rl-ph-soft);
  color: var(--rl-ph-text);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.rl-ph-icon-button:hover,
.rl-ph-icon-button:focus {
  background: #e5f1ee;
}

.rl-ph-icon-danger:hover,
.rl-ph-icon-danger:focus {
  background: #fee4e2;
  border-color: #fda29b;
}

.rl-ph-empty {
  border: 1px dashed var(--rl-ph-border);
  border-radius: 16px;
  padding: 20px;
  background: var(--rl-ph-soft);
  color: var(--rl-ph-muted);
}

.rl-ph-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 99999;
}

.rl-ph-modal {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.35);
}

.rl-ph-modal p {
  line-height: 1.5;
}

.rl-ph-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.rl-ph-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.demo-output {
  background: #fff;
  border: 1px solid var(--rl-ph-border);
  border-radius: 18px;
  box-shadow: var(--rl-ph-shadow);
  padding: 24px;
  margin-top: 22px;
}

.demo-output textarea {
  display: block;
  margin: 8px 0 14px;
}

@media (max-width: 850px) {
  .rl-ph-form-grid,
  .rl-ph-grid {
    grid-template-columns: 1fr;
  }

  .rl-ph-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
